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/19 08:28:17 UTC
PROPOSAL: Enhancement of templates
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
Re[2]: PROPOSAL: Enhancement of templates
Posted by Oleg V Alexeev <go...@penza.net>.
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
Re: PROPOSAL: Enhancement of templates
Posted by Cedric Dumoulin <ce...@lifl.fr>.
What you would like to do is to be able to use template "parameters"
in logic tags.
I have another solution to this problem : add a tag importing template
"parameter/attribute" in jsp scope (page, request, ...), as a bean.
Like this, you can use logic tag with the imported bean (which in
reality is a simple String).
<!-- import template attribute in the specified scope -->
<template:importAttribute name="chapter" scope="page" />
<!-- Do what you want with the bean -->
<logic:present name="chapter">
...
</logic:present>
Advantages of this approach :
* No need to modify existing logic tags
* No template stuff in struts core library : Struts and templates
still well separated
* Imported bean value can be used in any others tags accepting a bean
This proposed solution already exist in Components / Extended Templates.
So, you can test it immediately ...
Cedric
Components sites :
http://www.lifl.fr/~dumoulin/components/
(mirror) : http://www.geocities.com/cedricdumoulin/components/
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