You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dominik Stöttner <do...@gmx.net> on 2004/02/17 22:45:37 UTC
tiles advanced features
Hi,
I am still trying to create an webapplication with tiles that has similar functionality as a webapp written with portlets. Trying to define a default-layout for a tile I am facing some unresolved problems.
For more details see the code below (don't be worry about the long mail it's mostly code-fragments):
First I define a Layout for a Button, so that I can asign a controller to it.
//bttnLayout.jspf
<html:form action="/callPage.do">
<table align=center>
<tr>
<td>
<html:hidden property="bttnName" value='<tiles:getAsString name="buttonValue"/>'/>
<html:submit value='<tiles:getAsString name="button"/>' />
</td>
</tr></table>
</html:form>
For every Button I use in any of the Tiles I create a definition where I add the information
what page should be displayed next
//from tiles-defs.xml
<definition name="examples.help.testHelp" path="/layouts/bttnLayout.jspf">
<put name="button" value="help"/>
<put name="buttonValue" value="testHelp"/>
</definition>
The Layout for my Tiles and the definition for a TestTile looks as follows:
//tileLayout.jspf
<table border="0">
<tr>
<td width=80%><tiles:getAsString name="tileTitle"/></td>
<td width=10% align=right><tiles:insert attribute="tileHelpBttn"/></td>
<td width=10% align=right><tiles:insert attribute="tileEditBttn"/></td>
</tr>
<tr>
<td><tiles:insert attribute="tileBody"/></td>
</tr></table>
//from tiles-defs.xml
<definition name="examples.TestTile" path="/layouts/tileLayout.jspf">
<put name="tileTitle" value="Test-Tile"/>
<put name="tileHelpBttn" value="examples.help.testHelp"/>
<put name="tileEditBttn" value="examples.edit.testEdit"/>
<put name="tileBody" value="/tiles/Test.jsp"/>
</definition>
In the Controller asigned to the form used in the bttnLayou.jspf I simply ask for the value of the bttnName-parameter
and use the String to call the next Page.
But the problem is that the "<tiles:getAsString name="button"/>" is not rendered as a String in the bttnLayout.jspf. What do I have to change so that the value is rendered the right way?
For testing purpose I altered the tiles:getAsString-Statement into plain text (help, edit). But for some reasonse the form works only for the edit-Button although the code is the same for both buttons.
Finally I have got a question regarding a pageFlow within a Tile: I suppose it should be possible to create a pageFlow within a tile with two controllers: One that is defined at the tile with controllerUrl so that the right page can be put to the context before it is rendered. And a second one within the first jsp-page that defines the next-page that should be displayed. Is my assumption right? I suppose this might work since the rendering of the selected tiles in the tiles-documentation examples works almost the same way.
Thanks in advance!
dom
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org