首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

ssh关于命名空间的有关问题

2013-09-11 
ssh关于命名空间的问题搭建ssh框架做个小练习。出现以下错误。The server encountered an internal error ()

ssh关于命名空间的问题
搭建ssh框架做个小练习。出现以下错误。
The server encountered an internal error () that prevented it from fulfilling this request.

exception 

Unable to instantiate Action, StudentAction, defined for 'addStudent' in namespace '/'StudentAction
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:319)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:400)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)


web.xml文件配置是这样的。
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
  <display-name>Struts Blank</display-name>

  <filter>
  <filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>

  <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
  </filter-mapping>

  <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  </welcome-file-list>

</web-app>
struts.xml配置文件是这样的。

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
  <package name="default" namespace="/" extends="struts-default">  
  <action name="addStudent" class="StudentAction" method="addStudent">
  <result name="succ">succ.jsp</result>
  </action>  
  </package>
</struts>
哪位前辈指点一二,不胜感激

[解决办法]
namespace="/"去掉

class="X.X.X.X.StudentAction" 加上包名
[解决办法]
看看bean id 和struts.xml里面的class匹配不匹配
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行