struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject Re: action tag with tile result causing StackOverflowError-
Date Tue, 22 Nov 2016 08:36:56 GMT
In our apps we do similar things in a different way.


Our Tiles definition for layout looks like this:

<definition name=".layout" template="..../layout.jsp">
    <put-attribute name="title" value=".title" />
    <put-attribute name="content" value=".content" />
</definition>



Inside layout.jsp we insert the content provided by action like this:

<div id="content-container">
        <tiles:insertAttribute name="content" />
</div>



Actions provide content by using annotations:

@TilesDefinition(
        extend=".layout",
        putAttributes={
                @TilesPutAttribute(name="title", value="titel"),
                @TilesPutAttribute(name="content",value="content.jsp")
        }
)



Hope that helps!



Regards,
Christoph





> From: Vishal Jhagadiawala <vish_212@yahoo.com.INVALID>
> To: Struts Users Mailing List <user@struts.apache.org>, 
> Date: 21.11.2016 16:14
> Subject: Re: action tag with tile result causing StackOverflowError-
> 
> Hi Christoph,
> Please find my response below. 
> 
> Here is my actionTileResult.jsp (it is for test)
> ----actionResult.jsp
> This is text :
> <p>
> <tiles:insertAttribute name="title"/>
> </p>
> 
> - how should showcase.index.actionResult and showcase.index belong to 
each 
> other?   showcase.index is a global layout, and there are dynamic 
> pages based on action outcome eg . showcase.index.actionResult will 
> be included in the global layout
> 
> - shouldn't showcase.index.actionResult set the body attribute?    
> currently to reproduce the issue, I have used title attribute, but 
> we tile definition can be more specific based on need
> 
> - why is there an <s:action> tag in layout.jsp?          this is to 
> include dynamic result based on outcome of the action logic. 
> 
> 
> Regards,
> Vishal
> 
>     On Monday, 21 November 2016, 4:19, Christoph Nenning 
> <Christoph.Nenning@lex-com.net> wrote:
> 
> 
>  Hi,
> 
> 
> some questions about your code snippets:
> 
> - how does actionResult.jsp look?
> - how should showcase.index.actionResult and showcase.index belong to 
each 
> other?
> - shouldn't showcase.index.actionResult set the body attribute?
> - why is there an <s:action> tag in layout.jsp?
> 
> 
> Regards,
> Christoph
> 
> 
> 
> > From: Vishal Jhagadiawala <vish_212@yahoo.com.INVALID>
> > To: Struts Users Mailing List <user@struts.apache.org>, 
> > Date: 19.11.2016 20:55
> > Subject: Re: action tag with tile result causing StackOverflowError-
> > 
> > Hi ,
> > I also verified the exactly same error happens in struts 2.5.5 with 
> > tiles 3.0.7.
> > if we try to use action tag as below with tiles result it's goes in 
> > infinite loop and throws it throws java.lang.StackOverflowError,
> > <s:action name="myTestAction" namespace="/tiles" 
executeResult="true"/>
> > 
> > --------Layout.jsp 
> > <body>    <tiles:insertAttribute name="header"/>    
> > <tiles:insertAttribute name="body"/> <p>Notice that this is a layout
> > made in JSP</p>      <!-- issue with the action -->  <s:action 
> > name="myTestAction" namespace="/tiles" 
> executeResult="true"/></body></html>
> > 
> > ------------- struts.xml  <action name="myTestAction">            
> > <result type="tiles">showcase.index.actionResult</result>          
> > <result name="success" type="tiles">showcase.index.actionResult</
> > result>  </action>        ------------------tiles.xml
> >    <definition name="showcase.index" template="/WEB-INF/tiles/
> > layout.jsp">        <put-attribute name="title" value="Tiles 
> > Showcase"/>        <put-attribute name="header" value="/WEB-INF/
> > tiles/header.jsp"/>        <put-attribute name="body" value="/WEB-
> > INF/tiles/body.jsp"/>    </definition>
> > <definition name="showcase.index.actionResult" template="/WEB-INF/
> > tiles/actionResult.jsp">        <put-attribute name="title" 
> > value="Action Result"/></definition>
> > 
> >  Let me know if somebody faced same issue. 
> > Regards,Vishal
> > 
> >    On Saturday, 19 November 2016, 10:28, Vishal Jhagadiawala 
> > <vish_212@yahoo.com.INVALID> wrote:
> > 
> > 
> >  Hi ,
> > I have upgraded my struts application to version 2.3.30 and apache-
> > tiles 2.2.2 and I am facing issue with s:action tag and tiles 
> > result. it goes in recursive loop and throws StackOverflowError as 
> below. 
> > also I am able to reproduce this issue in showcase application, I 
> > have outlined the tiles.xml , struts-tile.xml and layout.jsp as below. 

> > it throws java.lang.StackOverflowError: null at 
> > org.apache.catalina.core.ApplicationHttpRequest.getAttribute
> > (ApplicationHttpRequest.java:230)        at 
> > org.apache.catalina.core.ApplicationHttpRequest.getAttribute
> > (ApplicationHttpRequest.java:230) at 
> > org.apache.catalina.core.ApplicationHttpRequest.getAttribute
> > (ApplicationHttpRequest.java:230) at 
> > org.apache.catalina.core.ApplicationHttpRequest.getAttribute
> > (ApplicationHttpRequest.java:230) .................. (truncated) 
> > .................        at 
> > com.opensymphony.xwork2.DefaultActionInvocation.invoke
> > (DefaultActionInvocation.java:245) at 
> > com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept
> > (AliasInterceptor.java:193) at 
> > com.opensymphony.xwork2.DefaultActionInvocation.invoke
> > (DefaultActionInvocation.java:245) at 
> > 
> 
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept
> > (ExceptionMappingInterceptor.java:189) at 
> > com.opensymphony.xwork2.DefaultActionInvocation.invoke
> > (DefaultActionInvocation.java:245) at 
> > org.apache.struts2.impl.StrutsActionProxy.execute
> > (StrutsActionProxy.java:54) at 
> > org.apache.struts2.components.ActionComponent.executeAction
> > (ActionComponent.java:288) at 
> > org.apache.struts2.components.ActionComponent.end
> > (ActionComponent.java:172) at 
> > org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag
> > (ComponentTagSupport.java:42) at 
> > 
> 
org.apache.jsp.WEB_002dINF.tiles.layout_jsp._jspx_meth_s_005faction_005f0
> > (layout_jsp.java:210) at 
> > 
> 
org.apache.jsp.WEB_002dINF.tiles.layout_jsp._jspService(layout_jsp.java:109)
> > 
> > Here is my usage, 
> > Layout.jsp
> > <html>    <head><title>Struts2 Showcase - <tiles:getAsString

> > name="title"/></title></head><body>    <tiles:insertAttribute

> > name="header"/>    <tiles:insertAttribute name="body"/> <p>Notice

> > that this is a layout made in JSP</p>        <!-- Vishal- action 

> > tag which is causing issue with tiles result --> <s:action 
> > name="myTestAction" namespace="/tiles" executeResult="true" 
> /></body></html>
> > 
> > tiles.xml
> >    <definition name="showcase.index" template="/WEB-INF/tiles/
> > layout.jsp">        <put-attribute name="title" value="Tiles 
> > Showcase"/>        <put-attribute name="header" value="/WEB-INF/
> > tiles/header.jsp"/>        <put-attribute name="body" value="/WEB-
> > INF/tiles/body.jsp"/>    </definition>      <!-- Vishal-- my 
> 
> definition -->    <definition name="showcase.index.actionResult" 
> > template="/WEB-INF/tiles/actionTileResult.jsp">        <put-
> > attribute name="title" value="Tiles Result from action"/>    
> </definition>    
> > struts-tiles.xml
> >        <action name="index">            <result 
> > type="tiles">showcase.index</result>            <result 
> > name="success" type="tiles">showcase.index</result>        </action>
> >        <!-- my test action to replicate the issue --> <action 
> > name="myTestAction">            <result 
> > type="tiles">showcase.index.actionResult</result>            <result
> > name="success" type="tiles">showcase.index.actionResult</result>    
> >    </action>  
> > actionTileResult.jsp
> > <tiles:importAttribute name="title" scope="request"/><html>    
> > <head><title>Action tile result <tiles:getAsString name="title"/></
> > title></head><body> <p>Notice that this is a  jsp</p></body></html>
> > 
> > 
> > Please let me know anybody faced similar issue and any solution to it.
> > Regards,Vishal
> > 
> > 
> 
> This Email was scanned by Sophos Anti Virus
> 
> 
> 

This Email was scanned by Sophos Anti Virus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message