为了账号安全,请及时绑定邮箱和手机立即绑定

请大家都帮忙解答一下,百度了好久也没改出来

我的Strust文件源代码:

<?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="helloworld" class="com.imooc.action.HelloWorldAction">

            <result >/result.jsp </result>

        </action>

    </package>



</struts>


报的错误为:

Caused by: Action class [com.imooc.action.HelloWorldAction] not found - action - file:/E:/na/mystrust/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorld/WEB-INF/classes/struts.xml:10:77

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295)

at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)

at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264)

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)

... 23 more


十一月 05, 2015 8:57:14 下午 org.apache.catalina.core.StandardContext filterStart

严重: Exception starting filter struts2

Unable to load configuration. - action - file:/E:/na/mystrust/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorld/WEB-INF/classes/struts.xml:10:77

at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:493)

at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)

at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)

at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)

at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)

at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)

at org.apache.catalina.core.StandardService.start(StandardService.java:525)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)

at org.apache.catalina.startup.Catalina.start(Catalina.java:595)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Caused by: Unable to load configuration. - action - file:/E:/na/mystrust/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorld/WEB-INF/classes/struts.xml:10:77

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)

at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)

at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)

at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)

... 20 more

Caused by: Action class [com.imooc.action.HelloWorldAction] not found - action - file:/E:/na/mystrust/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorld/WEB-INF/classes/struts.xml:10:77

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295)

at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)

at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264)

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)

... 23 more


正在回答

4 回答

就不用了噻

0 回复 有任何疑惑可以回复我~

package com.imooc.action;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorldAction {//不用继承
 
public String execute()  {
System.out.println("hjk");
return "success";

}
}

0 回复 有任何疑惑可以回复我~
#1

0801nana 提问者

为什么啊?引入的那个包就不没用了码
2015-11-10 回复 有任何疑惑可以回复我~

<action name="helloworld" class="com.imooc.action.HelloWorldAction">

    <result name="success">//这个地方需要你com.imooc.action.HelloWorldAction返回一个execute()的字符串

    /result.jsp

    </result>

    </action>

  


1 回复 有任何疑惑可以回复我~
#1

0801nana 提问者

我的Action是这样的: package com.imooc.action; import com.opensymphony.xwork2.ActionSupport; public class HelloWorldAction extends ActionSupport { @Override public String execute() throws Exception { System.out.println("hjk"); return "success"; } }
2015-11-10 回复 有任何疑惑可以回复我~

class没找到,就是com.imooc.action.HelloWorldAction没找到,输出 class="com.imooc.action.HelloWorldAction"内容是Alt+/让他自动提示看看是不是这个

1 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

请大家都帮忙解答一下,百度了好久也没改出来

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信