zoukankan      html  css  js  c++  java
  • 解决struts2中UI标签出现的问题: The Struts dispatcher cannot be found

    解决struts2中UI标签出现的问题: The Struts dispatcher cannot be found

     

    异常信息:
    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]

     

    jsp中使用了struts的标签,如果这边只拦截action的话,那就会出现jsp中struts标签无法解析的情况,找不到struts的分发器dispatcher,这通常是由于使用了struts标签,而没有配置相关联的filter。struts标签只有在http请求通过标签的servlet filter过滤器之后才可用,这些过滤器用来为这些标签初始化struts分发器

     

    解决办法:


    1.引入
    <%@ taglib prefix="s"  uri="/struts-tags" %>

     

    2.在web.xml中未将拦截的*.action改成/*
    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> 

     

    我当时出错就是第二种情况,是没有改WEB.XML中的拦截器

     

  • 相关阅读:
    mysql分区
    pl/sql查看tnsnames.ora文件路径
    mysql之事务控制和锁定语句
    mysql返回查询行数fund_rows()
    mysql之视图
    Mysql之btree索引和hash索引的区别
    Java中反射 API 的使用
    zookeeper 客户端 Apache curator 分布式锁实操
    springBoot 整合 ZooKeeper Java客户端之 Apache Curator 实战
    初识 ZooKeeper
  • 原文地址:https://www.cnblogs.com/riskyer/p/3323172.html
Copyright © 2011-2022 走看看