Thanks Christoph for suggestion, That's best way to do it, 
In my application I have lots of nested content, which is called by <s:action> 
along with tiles result. 

The code worked fine upto struts 2.2.1.1 and tiles 2.0.6 versions. after 
upgrading exactly same usage goes into infinite loop. and to refactor 
application it will be a big effort. 

is there anyway to open jira ticket, as this is reproducible so it can be 
tracked. 


Regards,
Vishal



    On Tuesday, 22 November 2016, 3:37, Christoph Nenning 
<christoph.nenn...@lex-com.net> wrote:
 

 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_...@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.nenn...@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_...@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_...@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


   

Reply via email to