0

下面是jsp代码

<ul class="nav pull-right">
          <s:if test="%{curUser != null}">
              <li class="dropdown">
                <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">%{curUser.userName}<b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <s:if test="%{curUser.admin eq true}">
                    <li><a href="/admin" title="Admin Section"><i class="icon-certificate"></i> Admin</a></li>
                  </s:if>
                  <li><a href="/user/%{curUser.userName}" title="%{curUser.userName}'s Profile"><i class="icon-user"></i> Profile</a></li>
                  <li><a href="/user/profile.html?action=edit"><i class="icon-cog"></i> Edit Profile</a></li>
                  <li><a href="/login.html?action=logout"><i class="icon-off"></i> Sign out</a></li>
                </ul>
              </li>
            </s:if>
            <s:else>
              <li><a href="/login">Login</a></li>
              <li class="divider-vertical"></li>
              <li><a href="/signup">Sign Up</a></li>
            </s:else>
        </ul>

我收到这个错误。需要帮助。

org.apache.jasper.JasperException: An exception occurred processing JSP page /decorators/base.jsp at line 45

42:               </a></li>
43:             </ul>
44:             <ul class="nav pull-right">
45:               <s:if test="%{curUser != null}">
46:                   <li class="dropdown">
47:                     <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">%{curUser.userName}<b class="caret"></b></a>
48:                     <ul class="dropdown-menu">

这是我的 web.xml 配置-我猜问题是使用带有站点网格的 Struts 标签。

   <filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter>
    <filter-name>LoginCheckFilter</filter-name>
    <filter-class>com.tutorial.filter.LoginCheckFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>LoginCheckFilter</filter-name>
    <url-pattern>/admin</url-pattern>
    <url-pattern>/admin/*</url-pattern>
  </filter-mapping>

  <filter>
    <filter-name>UrlRewriteFilter</filter-name>
    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
    <init-param>
      <param-name>logLevel</param-name>
      <param-value>WARN</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>UrlRewriteFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    <init-param>
      <param-name>actionPackages</param-name>
      <param-value>com.tutorial.action</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <listener>
    <listener-class>
      org.springframework.web.context.ContextLoaderListener
    </listener-class>
  </listener>

  <listener>
    <listener-class>org.apache.struts2.dispatcher.ng.listener.StrutsListener</listener-class>
  </listener>
4

1 回答 1

0

我也发生了同样的事情,触摸我也收到了另一个错误。发生的情况是struts标签在运行时没有被替换,所以它不能被html处理器编译。解决方法是在 web.xml 中,struts 过滤器映射必须高于 sitemesh 过滤器映射。

我在这个主题中得到了同样的回答: s:url not replace on decorator sitemesh

看看它是否听起来很熟悉。

于 2013-05-29T15:39:48.480 回答