yuyuyuxiaolei
johnny00000
采纳率0%
2016-07-06 17:28

struts.xml配置多个action问题

20

Struts.xml配置多个action 页面跳转找不到另外的action 但是直接访问action没有问题图片说明Unable to instantiate Action, action.teacherAction, defined for 'teacher_query' in namespace '/'action.teacherAction - action - file:/Users/yuxiaolei/Workspaces/tomcat-7/webapps/studentsystem/WEB-INF/classes/struts.xml:28:63
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:317)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:398)
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:37)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:557)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
root cause

java.lang.ClassNotFoundException: action.teacherAction
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
com.opensymphony.xwork2.ObjectFactory.getClassInstance(ObjectFactory.java:135)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:188)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:178)
com.opensymphony.xwork2.factory.DefaultActionFactory.buildAction(DefaultActionFactory.java:22)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:148)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:298)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:398)
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:37)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:557)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)图片说明

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • beijing20110905 微风吹过的夏天2016 5年前

    首先namespace改为/teacher
    其次你访问的路径应该是Teacher_query
    第一个*的部分是要作为class的,首字母必须大写。这样才能匹配TeacherAction.
    这样应该就能找到action.TeacherAction了

    或者
    name="teacher_{1}” class="action.TeacherAction"

    点赞 1 评论 复制链接分享
  • qq_18895659 AngusC· 5年前

    亲,命名空间哈,。。。。

    点赞 评论 复制链接分享
  • qq_35485029 唐之风采 5年前

    首先namespace改为/teacher
    其次你访问的路径应该是Teacher_query
    第一个*的部分是要作为class的,首字母必须大写。这样才能匹配TeacherAction.
    这样应该就能找到action.TeacherAction了

    或者
    name="teacher_{1}” class="action.TeacherAction"
    求大神采纳,万分感谢!!!

    点赞 评论 复制链接分享
  • yuyuyuxiaolei johnny00000 5年前

    命名空间我在/后面加了/teacher 还是报同样的错误

    点赞 评论 复制链接分享
  • qq_29866615 qq_29866615 5年前

    你最后面的命名空间不能为斜杠

    点赞 评论 复制链接分享

相关推荐