【问题标题】:How to use Struts2-jQuery Plugin with sitemesh如何在站点网格中使用 Struts2-jQuery 插件
【发布时间】:2011-02-01 06:57:59
【问题描述】:

当我尝试在 sitemesh 装饰器中包含标签 (http://code.google.com/p/struts2-jquery/wiki/HeadTag) 时出现此错误

main.jsp (decorator)
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>My Project- <decorator:title /></title>
  <sj:head compressed="false" jqueryui="true"></sj:head>
 </head>
 <body>
  <!-- head -->
.... 

Tomcat 错误

exception

java.lang.RuntimeException: org.apache.jasper.JasperException: An exception occurred processing JSP page /decorators/main.jsp at line 11

8:  <head>
9:   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10:   <title>My Project- <decorator:title /></title>
11:   <sj:head compressed="false" jqueryui="true"></sj:head>
12:  </head>
13:  <body>
14:   <!-- head -->


Stacktrace:
 com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:39)
 com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)

请问有什么办法吗?

提前致谢

【问题讨论】:

    标签: jquery struts2 sitemesh


    【解决方案1】:

    我刚刚发现我必须将此过滤器添加到我的 web.xml 中

    <filter>
        <filter-name>struts-cleanup</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
    </filter>
    

    谢谢

    【讨论】:

      【解决方案2】:

      答案在这里:

      web.xml

      <filter>
        <filter-name>struts-cleanup</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
      </filter>
      <filter-mapping>
        <filter-name>struts-cleanup</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
      

      现在,它工作正常(strut2、sitemesh 和 jquery)。

      问候

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-08-31
        • 2012-05-25
        • 1970-01-01
        • 2014-03-24
        • 2014-03-26
        • 1970-01-01
        相关资源
        最近更新 更多