开发者

Struts no action mapped issue

When deploying a struts application to tomcat running in eclipse I'm get开发者_StackOverflow中文版ting the following error to the console when trying to load the welcome page.

"There is no Action mapped for namespace / and action name . - [unknown location]"

I was trying to follow the tutorial at: http://viralpatel.net/blogs/2009/12/tutorial-create-struts-2-application-eclipse-example.html.

I am obviously just getting started with struts and any help would be appreciated.


Make sure to have the URL-Pattern mapped to Struts in your web.xml file.

<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>*.html</url-pattern>
    </filter-mapping>

Make sure you have the action name then mapped to a Java class in your struts.xml.

<action name="find" class="findAction" method="input">
     <interceptor-ref name="myStack" />
     <result name="input">find</result>
</action>

These are the essentials. The result will then need mapped to a JSP. Good Luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜