我的struts2版本是:2.2.3.1
我加了struts2的那五个包
我加了过滤器
<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>
为什么我的jsp运行就404错误。
但是当我没有加入任何过滤器的时候,myeclipse自带的测试jsp文件(index.jsp)却可以正常显示!
只要一加任何过滤器就直接404错误!如下:
type Status reportmessage description The requested resource () is not available.
我搞不懂为什么总是错,请各位帮忙看下!
本人的分不多了、请见谅……
我加了struts2的那五个包
我加了过滤器
<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>
为什么我的jsp运行就404错误。
但是当我没有加入任何过滤器的时候,myeclipse自带的测试jsp文件(index.jsp)却可以正常显示!
只要一加任何过滤器就直接404错误!如下:
type Status reportmessage description The requested resource () is not available.
我搞不懂为什么总是错,请各位帮忙看下!
本人的分不多了、请见谅……
这个filter,
还有你进入action的方式错误了,你可能是.action或者.do,可能myeclipse可以生成,但是工具是用错误的
我建议你自己写个
在你的struts.xml中的第一个packge上面加入这样一句
<constant name="struts.action.extension" value="do,action"></constant>
这句话表示,你在跳转的时候可以.do或者.action进入action<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.action.extension" value="do,action,in"></constant>
<package name="it" namespace="/test" extends="struts-default">
<action name="te" class="com.test.IndexAction" method="execute">
<result name="success">/message.jsp</result>
</action>
</package>
</struts> 这是个例子,如果你想要条到IndexAction里面 应该是这样的http://127.0.0.1:8080/项目名/test/te.do
这是试试了