This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I really don't want to write an entire new set of actions - to tie them to a simplified layout (i.e. just the 'content')
Ideally, I'd like to be able to determine (within my action code) which layout to use... but I fear it is too late in the process to do that.
My actions are tied to the Tile/layout by (I think) my input=gymMaintenance.page (i believe this may be part of the problem/solution) - below are 2 of my a action definitions:
This is my tile/layout definition:
If I could just override that "extends='layout_b'" with (something like) "extends='contentOnlyLayout'" at runtime, based on my switch AJAX=1
I'm new to Struts and Java... hope I'm making some sense!
First, if you are new to Struts why are you leasrning an old version and not the latest version?
As to your problem, no, you cannot do an override.
From what I can gather about your question it looks like you want to submit the form but then only have the "content" tiles section refreshed. If that's what you want to do then you need to make if so your content, gymMaintenance.jsp, can be refreshed using AJAX. That will be the only way you can change the content only.
Joined: Jun 28, 2010
Ok - so there is a solution. First, I had to change my struts config to NOT associate the page with a layout/template. Next, I had to create a stub jsp file that would examine my parameter 'AJAX=1' - depending on the value, the stub file chooses the definition:
My actions now point to the stub page (gymMaintenanceStub.jsp) and each of the above mentioned tile definitions point to my original jsp page for their content section:
Everything works fine - validation, ActionForm is accessible... there was no further work needed on the server.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Struts / Tiles - changing which layout is used at runtime