web.xml的filter
<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>/*</url-pattern>
</filter-mapping>
struts.xml
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index" />
<global-results>
<result name="error">/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="error"/>
</global-exception-mappings>
<action name="index">
<result>index.jsp</result>
</action>
</package>
<include file="example.xml"/>
</struts>
------解决思路----------------------
启动tomcat在浏览器终会输入http://localhost:8080/xx/index.pl xx为项目名称
------解决思路----------------------
你这个struts.xml配置文件错了吧,应该是这样吧,
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<constant name="struts.devMode" value="false" />
<package name="default" namespace="/" extends="struts-default">
<action name="login" class="com.test.action.LoginAction" method="login" >
<result name="success">loginSuccess.jsp</result>
<result name="failure">login.jsp</result>
</action>
</package>
</struts>
------解决思路----------------------
你是不是把刚建web项目时候去掉Context root URL哦,这样的话可以直接访问http://localhost:8080就行了。
------解决思路----------------------
你用了Struts 但是访问的地址好像不是action吧 你得按照Struts的规则来啊
------解决思路----------------------
过滤器拦截了页面