You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kibo <to...@gmail.com> on 2008/06/05 16:18:57 UTC

dynamically view templates

 Hi Conference
 
I  use Struts 2 and freemarker:
 
 <action name="test" class="com.acme.TestAction">
    <result name="success" type="freemarker">success.ftl</result>
</action>
 
but
I need load freemarker template dynamically. For example:
In page is selectBox (<select>) with items:
- template1
- tempalte 2
- template 3
When user click in item template1, I want to return him view, which use
template1.
When user click in item tempate2, I want to return him view, which use
tempate2.
etc.
 
I need help how to do. I need not exactly code way, only help how can i do
it. 
 
Thank for help very much.
 

-----
Tomas Jurman
Czech Republic
-- 
View this message in context: http://www.nabble.com/dynamically-view-templates-tp17670937p17670937.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: dynamically view templates

Posted by Musachy Barroso <mu...@gmail.com>.
You can use OGNL in the result like this:

 <action name="test" class="com.acme.TestAction">
   <result name="success" type="freemarker">${template}</result>
</action>

then you can have a getTemplate() method in your action that returns
the right template.

musachy

On Thu, Jun 5, 2008 at 10:18 AM, Kibo <to...@gmail.com> wrote:
>
>  Hi Conference
>
> I  use Struts 2 and freemarker:
>
>  <action name="test" class="com.acme.TestAction">
>    <result name="success" type="freemarker">success.ftl</result>
> </action>
>
> but
> I need load freemarker template dynamically. For example:
> In page is selectBox (<select>) with items:
> - template1
> - tempalte 2
> - template 3
> When user click in item template1, I want to return him view, which use
> template1.
> When user click in item tempate2, I want to return him view, which use
> tempate2.
> etc.
>
> I need help how to do. I need not exactly code way, only help how can i do
> it.
>
> Thank for help very much.
>
>
> -----
> Tomas Jurman
> Czech Republic
> --
> View this message in context: http://www.nabble.com/dynamically-view-templates-tp17670937p17670937.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: dynamically view templates

Posted by Dave Newton <ne...@yahoo.com>.
--- On Thu, 6/5/08, Kibo <to...@gmail.com> wrote:
> [specifying template based on form value]

You can use OGNL in your configuration.

http://struts.apache.org/2.0.11.1/docs/parameters-in-configuration-results.html

Dave


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