You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Barrows <jb...@sssc.com> on 2004/08/27 23:03:18 UTC

Interesting tiles/redirect interaction problem

I'm using tiles, and some of the tiles are summary pages.  For instance a payment summary, it just shows the date and the amount.  While the detail page shows how the payment was applied (how much to interest etc.)
So my tiles definition looks like:
<definition name="mainLayout" path="/layout/layout2.jsp">
        <put name="title"  value="This is a title" />
        <putList name="headerList">        	
        	<add value="/errorMessages.jsp"/>
        	<add value="/successMessages.jsp"/>
        	<add value="/showMessages.do"/> 
        </putList>
        <putList name="leftSideList">
    		<add value="/showBorrowerDemographics.do?detail=summary"/>
    		<add value="/showSwiftPay.do"/>
    		<add value="/showPaymentHistory.do?detail=summary"/>
    	</putList>
    	<putList name="centerList">
    		<add value="/layout/body.jsp"/>
    	</putList>
    	<putList name="rightSideList">    		
    		<add value="/resources.jsp"/>
    		<add value="/layout/links.jsp"/> 
    		<add value="/showDeferments.do"/> 
    		<add value="/showForebearances.do"/>  		
    	</putList>
    	<putList name="footerList">
    		<add value="/layout/footer.jsp"/>
    	</putList>
    </definition>

Okay, this works... now let's say /showPaymentHistory.do encounters something catastrophic, like DB down etc.  So, it throws a BusinessObjectException.  Cool.. that works....
Now, I've never used the exception handling stuff in struts-config.xml.... so here's the definition:
<exception type="com.sssc.csr.businessObjects.BusinessObjectExeception" 
	key="errors.applicationFailure" 
	handler="com.sssc.csr.web.exceptionHandlers.BusinessObjectExceptionHandler" 
	path="/applicationFailure.do">
</exception>

And the handler says:
LogWrapper.logAlert( "Business Object Exception: " + ex.getMessage());
        ActionForward forward = mapping.findForward( "applicationFailure");
        return forward;
and the forward has redirect = true in the struts-config.xml

So..... I would expect that even though the summary pagelet is throwing the exception, that it would forward to the applicationFailure tiles definition.  What I didn't expect was for the entire page to end up nested inside the original page being requested.
Shouldn't redirect=true do what I expect with regards to tiles?  and pop to a new tiles definition rather then include it?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Interesting tiles/redirect interaction problem

Posted by Jason Lea <ja...@kumachan.net.nz>.
 From what I can see here it looks like the page is already being 
written out when the error occurs from what I can see.
You have gone to your first action, done some work, then return the 
mainLayout tile.  The tile then starts building the response based on 
layout2.jsp.  It includes the pages you have in the list.  
showBorrowerDemographics.do?detail=summary is calling an action and the 
result is included in the page.

When the error occurs, it redirects to the applicationFailure tile, and 
it is included in the mainLayout.

Perhaps you either need to change your applicationFailure tile so it 
returns a tile page instead of a complete web page.  Or have 
showPaymentHistory throw a different exception which gets caught and 
returns a tile.  If your main action failed it would want to throw the 
exception and have a whole page constructed and returned, but a tile 
should return a simple tile not a whole page.


Jim Barrows wrote:

>I'm using tiles, and some of the tiles are summary pages.  For instance a payment summary, it just shows the date and the amount.  While the detail page shows how the payment was applied (how much to interest etc.)
>So my tiles definition looks like:
><definition name="mainLayout" path="/layout/layout2.jsp">
>        <put name="title"  value="This is a title" />
>        <putList name="headerList">        	
>        	<add value="/errorMessages.jsp"/>
>        	<add value="/successMessages.jsp"/>
>        	<add value="/showMessages.do"/> 
>        </putList>
>        <putList name="leftSideList">
>    		<add value="/showBorrowerDemographics.do?detail=summary"/>
>    		<add value="/showSwiftPay.do"/>
>    		<add value="/showPaymentHistory.do?detail=summary"/>
>    	</putList>
>    	<putList name="centerList">
>    		<add value="/layout/body.jsp"/>
>    	</putList>
>    	<putList name="rightSideList">    		
>    		<add value="/resources.jsp"/>
>    		<add value="/layout/links.jsp"/> 
>    		<add value="/showDeferments.do"/> 
>    		<add value="/showForebearances.do"/>  		
>    	</putList>
>    	<putList name="footerList">
>    		<add value="/layout/footer.jsp"/>
>    	</putList>
>    </definition>
>
>Okay, this works... now let's say /showPaymentHistory.do encounters something catastrophic, like DB down etc.  So, it throws a BusinessObjectException.  Cool.. that works....
>Now, I've never used the exception handling stuff in struts-config.xml.... so here's the definition:
><exception type="com.sssc.csr.businessObjects.BusinessObjectExeception" 
>	key="errors.applicationFailure" 
>	handler="com.sssc.csr.web.exceptionHandlers.BusinessObjectExceptionHandler" 
>	path="/applicationFailure.do">
></exception>
>
>And the handler says:
>LogWrapper.logAlert( "Business Object Exception: " + ex.getMessage());
>        ActionForward forward = mapping.findForward( "applicationFailure");
>        return forward;
>and the forward has redirect = true in the struts-config.xml
>
>So..... I would expect that even though the summary pagelet is throwing the exception, that it would forward to the applicationFailure tiles definition.  What I didn't expect was for the entire page to end up nested inside the original page being requested.
>Shouldn't redirect=true do what I expect with regards to tiles?  and pop to a new tiles definition rather then include it?
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>


-- 
Jason Lea



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org