Hi,
I an trying to build a site using Tiles & Struts (first time newbie) and
it seems I am unable to get the Tiles controller to override at run-time
the attribute values (e.g. page title)
I'm using Struts 1.0.2 and tilesForStruts1.0.jar. My tile-defs.xml looks
like:
<tiles-definitions>
<definition name="corridorTemplate" path="/templates/template.jsp">
<put name="page.title" value="Extreme/dark music webzine"/>
<put name="content.title" value="Corridor of Cells"/>
<put name="content.body" value=""/>
<put name="leftbar" value="/templates/leftbar.jsp"/>
<put name="rightbar" value="/templates/rightbar.jsp"/>
<put name="footer" value="/templates/footer.jsp"/>
</definition>
<!-- main page -->
<definition name="whatsnewTemplate" extends="corridorTemplate"
controllerUrl="/whatsnewController.do">
<put name="page.title" value="TEST"/>
<put name="content.title" value="TEST"/>
<put name="content.body" value="TEST"/>
</definition>
</tiles-definitions>
The "/whatsnewController.do" controller action is defined in
struts-config.xml as:
<action path="/whatsnewController"
type="com.corridorofcells.action.WhatsNewController"></action>
and the actual com.corridorofcells.action.WhatsNewController class's
perform() looks like:
public final class WhatsNewController extends TilesAction {
public ActionForward perform(
ComponentContext context,
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
context.putAttribute("page.title", "Extreme/dark music webzine");
context.putAttribute("content.title","What's New");
context.putAttribute("content.body", "Hey, what's new????");
return null;
}
}
However, at run-time, the values of "page.title" and "content.title" are
never overriden (in the "template.jsp" I fetch them using
<tiles:getAsString name="page.title"> etc).
They're always left to the base value I defined in "whatsNewTemplate",
i.e. the value "TEST". They never seem to get updated at run-time with
the overriden values I "put" in the WhatsNewController class.
I've wasted 2 days on this and about to give up and just do
down-and-dirty JSP instead of clean and smooth Tiles...the docs say this
should work, but in my case such a basic example just doesn't work.
Help! What am I doing wrong here?
Thanks in advance for help,
Jacek
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- Re: Problems with Tiles and ControllerUrl Zaraza / Corridor of Cells
- Re: Problems with Tiles and ControllerUrl Cedric Dumoulin
- Re: Problems with Tiles and Controller... Zaraza
- Re: Problems with Tiles and Contro... Cedric Dumoulin