based on struts2 appfuse maven project I am trying to set up my personal HelloWorld struts2 maven project.
I have simplified a lot of things in pom.xml, web.xml and struts.xml file. As a result of that, it seems that <welcome-file-list>
and <welcome-file>
tags are not getting into account, and when I hit http://localhost:8080/, my file index.jsp is not loaded.
Next error message appears:
There is no Action mapped for namespace / and action name .
(after word ‘name’, is a blank space)
Any comments will be appreciated.
Inside web.xml:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</开发者_运维技巧filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
Inside struts.xml:
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="Menu">
<result>/menu/Menu.jsp</result>
</action>
</package>
Seems struts2 filter is trying to find the action for the name empty "" or "/" path. So welcome list will not be reached. Also no entry in struts.xml for "" & "/". thats y getting this error.
so add the below entry in struts.xml will solve this issue..
<action name=""> <result>jsp file path</result></action>
<action name="/"> <result>jsp file path</result></action>
精彩评论