0
下面是JSP代碼Struts2的標籤給碧玉例外
<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標籤sitemesh。
<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>
'CurUser'是否存在於值棧中? – orique 2012-08-04 20:49:16
其他的Struts2 jsps渲染是否正確? – rees 2012-08-04 22:33:48
使用標籤 確保curUser對象在valuestack中可用。或者,如果頁面正常渲染,則刪除(if-else)塊問題是curUser在valueStack中不可用。 –
2012-08-05 14:00:23