Redirect from tile controller
Hi, I have a layout JSP (layout.jsp) with two tiles. I am using tile controllers to populate data to be displayed in each tile. Code is specified below. If an exception is thrown by 2nd tile controller, is there a way to redirect to a completely new JSP (say error.jsp), instead of displaying the layout JSP? There is no return Actionforward from a org.apache.struts.tiles.Controller (as is present in Action class). Thanks, RG layout.jsp: --- HTMLBODYtable trtd tiles:insert definition=.A/ /tr/td trtd tiles:insert definition=.B/ /tr/td /table/BODY/HTML definition name=.A path=/a.jsp controllerClass=ATileController / definition name=.B path=/b.jsp controllerClass=BTileController /
Re: Redirect from tile controller
If you are using TilesRequestProcessor as your controller (and it's probably not limited to this class) you can extend it to add any methods you need to call from an Action's execute(...) method. The trick is getting an instance of the controller from within the action - and I don't know how to do that off hand. I've previously asked this question but did not receive a satisfactory response - someone suggested that it might be on the request - it wasn't. -adam Gupta, Rahul wrote: Hi, I have a layout JSP (layout.jsp) with two tiles. I am using tile controllers to populate data to be displayed in each tile. Code is specified below. If an exception is thrown by 2nd tile controller, is there a way to redirect to a completely new JSP (say error.jsp), instead of displaying the layout JSP? There is no return Actionforward from a org.apache.struts.tiles.Controller (as is present in Action class). Thanks, RG layout.jsp: --- HTMLBODYtable trtd tiles:insert definition=.A/ /tr/td trtd tiles:insert definition=.B/ /tr/td /table/BODY/HTML definition name=.A path=/a.jsp controllerClass=ATileController / definition name=.B path=/b.jsp controllerClass=BTileController / - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Redirect from tile controller
In general, the RequestProcessor calls processActionPerform() (that returns the ActionForward, say FORWARD1) and then last thing it calls is processActionForward(). Is there a way to redirect the request to a different ActionForward if there is a problem with FORWARD1? -RG -Original Message- From: Adam Gordon [mailto:[EMAIL PROTECTED] Sent: Friday, September 15, 2006 10:05 AM To: Struts Users Mailing List Subject: Re: Redirect from tile controller If you are using TilesRequestProcessor as your controller (and it's probably not limited to this class) you can extend it to add any methods you need to call from an Action's execute(...) method. The trick is getting an instance of the controller from within the action - and I don't know how to do that off hand. I've previously asked this question but did not receive a satisfactory response - someone suggested that it might be on the request - it wasn't. -adam Gupta, Rahul wrote: Hi, I have a layout JSP (layout.jsp) with two tiles. I am using tile controllers to populate data to be displayed in each tile. Code is specified below. If an exception is thrown by 2nd tile controller, is there a way to redirect to a completely new JSP (say error.jsp), instead of displaying the layout JSP? There is no return Actionforward from a org.apache.struts.tiles.Controller (as is present in Action class). Thanks, RG layout.jsp: --- HTMLBODYtable trtd tiles:insert definition=.A/ /tr/td trtd tiles:insert definition=.B/ /tr/td /table/BODY/HTML definition name=.A path=/a.jsp controllerClass=ATileController / definition name=.B path=/b.jsp controllerClass=BTileController / - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]