基于struts2 appfuse maven项目我正在尝试建立我个人的HelloWorld struts2 maven项目。
我在pom.xml,web.xml和struts.xml文件中简化了很多东西。因此,似乎没有考虑<welcome-file-list>
和<welcome-file>
标记,当我点击http://localhost:8080/时,我的文件index.jsp未加载。
出现下一条错误消息:
没有针对命名空间/和操作名称映射的操作。
(在'name'之后,是一个空格)
任何意见将不胜感激。
内部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>
在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>
答案 0 :(得分:0)
似乎struts2过滤器试图找到名为空“”或“/”路径的动作。所以不会到达欢迎名单。 struts.xml中没有“”和“&amp;”的条目。 “/”。那就是这个错误。
所以在struts.xml中添加以下条目将解决这个问题..
<action name=""> <result>jsp file path</result></action>
<action name="/"> <result>jsp file path</result></action>