我有一個JSP,這就要求使用<s:action>
標籤的動作:Struts2的/瓷磚內部異常
<s:form>
<s:action name="myaction"
namespace="/utente/include" executeResult="true"
ignoreContextParams="true" var="formattazione" />
//do something
</s:form>
動作myaction
被調用時,我可以按照流程調試它。它完成沒有錯誤,它返回成功,但然後有一個錯誤,我不明白哪一個。
動作定義:
<package name="utente-include" namespace="/utente/include" extends="tiles-default">
<action name="myaction" class="com.emaborsa.doctracing.web.action.formattazione.FormattazioneCriteriUtenteAction"
method="formattazione">
<result type="tiles">mytiles.def</result>
</action>
</package>
瓦片定義:
<definition name="mytiles.def" template="/pages/empty.jsp">
<put-attribute name="body" value="/pages/mypage.jsp"/>
</definition>
的empty.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<tiles:insertAttribute name="body" />
除外:
GRAVE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)
at org.apache.jsp.pages.utente.elencoUtenti_jsp._jspx_meth_s_005fif_005f0(elencoUtenti_jsp.java:215)
at org.apache.jsp.pages.utente.elencoUtenti_jsp._jspx_meth_s_005fform_005f0(elencoUtenti_jsp.java:155)
at org.apache.jsp.pages.utente.elencoUtenti_jsp._jspService(elencoUtenti_jsp.java:87)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
.....
編輯: 我認爲它的工作原理,但它沒有。實際上系統不會崩潰,但瓷磚頁面不包含在郵件頁面中。該例外,我得到:
org.apache.tiles.impl.CannotRenderException: No request dispatcher returned for path '/../pages/common/myPage.jsp'
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:680)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:633)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:322)
at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
這裏我myPage.jsp(其實也無所謂什麼是寫在):
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<div class="navigazioneElenco" id="navigazioneElenco">
</div>
在這裏,我分享我的項目的一部分。只有不工作的部分... DOWNLOAD
[看看這個,它可能* *幫助...](https://issues.apache.org/jira/browse/WW-2995?focusedCommentId=12824702&page= com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12824702) –
'
Emaborsa
如果您正在使用Struts2的-Tiles3,看看這個:http://stackoverflow.com/a/14540358/1654265 –