当前位置:编程学习 > JAVA >>

急急急急急急~JSP使用struts2标签报错啊~本机没问题,在服务器就有问题

我写的项目,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>

JSP页面也引入了
<%@ taglib prefix="s" uri="/struts-tags"%>

但是为什么只要有struts标签就报错

HTTP Status 500 - 


type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception 
org.apache.jasper.JasperException: The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]


root cause 
The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]


note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.2.2 logs.


GlassFish Server Open Source Edition 3.1.2.2


很着急啊~求各位大神快来帮忙吧~
struts标签 JSP报错 --------------------编程问答-------------------- 先说一点 你的struts2 好像版本低了  我周末配置最新的jar,filter-class不是这个 --------------------编程问答-------------------- 如果想要在 jsp 文件中,采用 struts 的 tag,那么必须通过 web.xml 所配置的过滤器访问文件。你把 s 标签去了就没问题了。 --------------------编程问答-------------------- 我现在是要用struts标签的,怎么能去掉呢,帮帮忙,怎么搞啊~ --------------------编程问答-------------------- web.xml中添加配置:

<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping> --------------------编程问答-------------------- 这个过滤器很久以前是那个  新版本换了,是org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter --------------------编程问答-------------------- 你这版本太低了 --------------------编程问答-------------------- struct完整配置如下:
  <filter>     
        <filter-name>struts-cleanup</filter-name>     
        <filter-class>     
            org.apache.struts2.dispatcher.ActionContextCleanUp    
        </filter-class>     
    </filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
    <filter-mapping>     
        <filter-name>struts-cleanup</filter-name >     
        <url-pattern>/*</url-pattern>     
    </filter-mapping>   
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> --------------------编程问答-------------------- 绝对版本问题 --------------------编程问答-------------------- FilterDispathcer (org.apache.struts2.dispatcher.FilterDispatcher)  在早期的Struts2开发中使用,从Struts 2.1.3开始,它已不推荐使用。
如果你使用的Struts的版本 >= 2.1.3,
推荐升级到新的Filter-StrutsPrepareAndExecuteFilter  (org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter)。
看下你struts的jar包版本和struts配的过滤器匹配好了没有 --------------------编程问答-------------------- org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,