You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Oleg V Alexeev <go...@penza.net> on 2001/06/20 11:31:31 UTC

Re[2]: PROPOSAL: Enhancement of templates

Hello Cedric,

Thank you, the solution there is.

Wednesday, June 20, 2001, 1:26:13 PM, you wrote:


CD>   What you would like to do is to be able to use template "parameters"
CD> in logic tags.
CD>   I have another solution to this problem : add a tag importing template
CD> "parameter/attribute" in  jsp scope (page, request, ...), as a bean.
CD> Like this, you can use logic tag with the imported bean (which in
CD> reality is a simple String).

CD>   <!-- import template attribute in the specified scope -->
CD> <template:importAttribute name="chapter" scope="page" />
CD>   <!-- Do what you want with the bean -->
CD>  <logic:present name="chapter">
CD> ...
CD> </logic:present>

CD> Advantages of this approach :

CD>    * No need to modify existing logic tags
CD>    * No template stuff in struts core library : Struts and templates
CD>      still well separated
CD>    * Imported bean value can be used in any others tags accepting a bean

CD> This proposed solution already exist in Components / Extended Templates.
CD> So,  you can test it immediately ...

CD>   Cedric

CD> Components sites :
CD>   http://www.lifl.fr/~dumoulin/components/
CD>   (mirror) : http://www.geocities.com/cedricdumoulin/components/

CD> Oleg V Alexeev wrote:

>> Hello struts-dev,
>>
>> Now I use next scheme to pass parameters to the template page -
>>
>> --------------- page ------------
>> <template:insert template="layout/main.jsp?chapter=news">
>> </template:insert>
>> ---------------------------------
>>
>> and check parameter 'chapter' in template.
>> -------------- template ---------
>> <logic:present parameter="chapter">
>> ...
>> </logic:present>
>> ---------------------------------
>>
>> But I think that this approach is not so flexible because of direct
>> query string editing. For my mind constructions listed below is more
>> preferable -
>>
>> --------------- page ------------
>> <template:insert template="layout/main.jsp">
>>  <template:put name="chapter" content="news" direct="true"/>
>> </template:insert>
>> ---------------------------------
>>
>> -------------- template ---------
>> <logic:present template="chapter">
>>  <bean:define id="chapter" template="chapter"/>
>>  ....
>> </logic:present>
>> ---------------------------------
>>
>> How about it?
>>
>> --
>> Best regards,
>>  Oleg                         mailto:gonza@penza.net




-- 
Best regards,
 Oleg                            mailto:gonza@penza.net