struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Affan Qureshi" <quere...@etilize.com>
Subject Re: [Tiles] Design - Overriding <putList> items
Date Sat, 15 Mar 2003 07:07:13 GMT
Thanks for the explanation. I have also implemented a similar solution (by
looking at the examples). The problem i am facing is the modification of
session value in the actions. I mean when the session values are modified in
each Action, it makes my code hard to maintain and error-prone. Because now
the layout logic is spread all over the place in my actions. I know this is
more of a design issue than an implementation one.

Also, sometimes I need to forward to actions but also want to pass
parameters to it in the query string. In this case I cannot use
mapping.findForward("Success"). I have to create a new ActionForward object
and provide the url plus the query string. This is again hard-coding of the
urls. Is there any way I can specify request paramters for a forward in
Tiles or Struts?

Thanks,

Affan

>   In tiles examples I use the following for a user customized menu:
>
>     * A definition contain the attributes for the menu, with a list of
>       default items to show.
>     * The controller  try to retrieve a customized list of items (from
>       the session, but could be from a persistent storage)
>           o If the list isn't found, get the one defined in the tile
>             context from the definition, copy it and store it
>             appropriately in the session. So, the list in the definition
>             is used to initialize the default values !
>     * Replace the list in the tile context with the customized one
>     * Return from the controller and show the tile
>
>   In this scenario, the definition is used to defined the default
> values. So, the management still centralized in the xml file. The
> controller is used to prepare appropriately the data to show.
>
> Hope this help,
>
>   Cedric
>
> >
> >Thanks a lot,
> >Affan
> >
> >PS
> >My Tiles Code below:
> >
> >This is my basic/default definition:
> >
> ><definition name="index.page" path="/webpages/layouts/tabsLayout.jsp"
> >controllerClass="com.etilize.cms.web.actions.LayoutProcessorAction">
> >    <put name="title" value="MyAppName"/>
> >    <put name="header" value="/webpages/header.jsp"/>
> >    <put name="footer" value="/webpages/footer.jsp"/>
> >    <put name="selectedIndex" value="0"/>
> >    <put name="parameterName" value="selected"/>
> >    <putList name="tabList">
> >        <item value="Home" link="/webpages/home.jsp"
> >classtype="org.apache.struts.tiles.beans.SimpleMenuItem"/>
> >        ................
> >        <item value="Taxonomy" link="/webpages/template.jsp"
> >classtype="org.apache.struts.tiles.beans.SimpleMenuItem"/>
> >        ..................
> >        <item value="Search" link="/webpages/search.jsp"
> >classtype="org.apache.struts.tiles.beans.SimpleMenuItem"/>
> >    </putList>
> ></definition>
> >
> >In actions i have the following code to set the values in the session
bean:
> >        LayoutSettings settings =
>
>(LayoutSettings)req.getSession(true).getAttribute(WebAppConstants.TAB_LAYOU
T
> >_SETTINGS);
> >        List tabList = settings.getTabList();
> >        SimpleMenuItem searchTab = (SimpleMenuItem)tabList.get(3);
> >        searchTab.setLink(returnLink);
> >        tabList.set(3,searchTab);
> >        settings.setTabList(tabList);
> >
>
>req.getSession(true).setAttribute(WebAppConstants.TAB_LAYOUT_SETTINGS,setti
n
> >gs);
> >


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


Mime
View raw message