You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Xabier Burgos Gimeno <xa...@yahoo.es> on 2010/05/19 17:44:47 UTC

EL Expression and Velocity templates

Hello all,

Is it possible to use a an EL 
expression in a tiles definition and get it rendered correctly in a 
velocity template?, something like:

<put-list-attribute 
name="styleSheets">
           <add-attribute 
expression="${requestScope.url}/css/jquery-ui.css" type="velocity"/>
           <add-attribute 
expression="${requestScope.url}/css/master.css" type="velocity"/>
</put-list-attribute>

And then in the template

$tiles.importAttribute({"name":"styleSheets"})
#foreach($styleSheet in $styleSheets)
            <link type="text/css" 
rel="stylesheet" href="${styleSheet.value}"/>
#end

Maybe 
I'm missing something?.

Thanks in advance,

Xabier.



      

Re: EL Expression and Velocity templates

Posted by Antonio Petrelli <an...@gmail.com>.
2010/5/20 Xabier Burgos Gimeno <xa...@yahoo.es>:
> Nope, Still not working :(

I give up. What you can do is packing a project and send it to me in a
private email, preferably as a Maven project.

Antonio

Re: EL Expression and Velocity templates

Posted by Xabier Burgos Gimeno <xa...@yahoo.es>.
Nope, Still not working :(



----- Mensaje original ----
De: Antonio Petrelli <an...@gmail.com>
Para: users@tiles.apache.org
Enviado: jue,20 mayo, 2010 11:04
Asunto: Re: EL Expression and Velocity templates

2010/5/20 Xabier Burgos Gimeno <xa...@yahoo.es>:
> That's what I said, it renders $tiles.render($styleSheet) , literally.

Doh! Sorry for not understanding it before. Try to use some curly brackets then:
${tiles.render(${styleSheet})}

Antonio



      

Re: EL Expression and Velocity templates

Posted by Antonio Petrelli <an...@gmail.com>.
2010/5/20 Xabier Burgos Gimeno <xa...@yahoo.es>:
> That's what I said, it renders $tiles.render($styleSheet) , literally.

Doh! Sorry for not understanding it before. Try to use some curly brackets then:
${tiles.render(${styleSheet})}

Antonio

Re: EL Expression and Velocity templates

Posted by Xabier Burgos Gimeno <xa...@yahoo.es>.
That's what I said, it renders $tiles.render($styleSheet) , literally.



----- Mensaje original ----
De: Antonio Petrelli <an...@gmail.com>
Para: users@tiles.apache.org
Enviado: jue,20 mayo, 2010 10:51
Asunto: Re: EL Expression and Velocity templates

2010/5/20 Xabier Burgos Gimeno <xa...@yahoo.es>:
> Nope, I'm afraid it doesn't.

Does it render something else, or do you see an exception?

Antonio



      

Re: EL Expression and Velocity templates

Posted by Antonio Petrelli <an...@gmail.com>.
2010/5/20 Xabier Burgos Gimeno <xa...@yahoo.es>:
> Nope, I'm afraid it doesn't.

Does it render something else, or do you see an exception?

Antonio

Re: EL Expression and Velocity templates

Posted by Xabier Burgos Gimeno <xa...@yahoo.es>.
Nope, I'm afraid it doesn't.



----- Mensaje original ----
De: Antonio Petrelli <an...@gmail.com>
Para: users@tiles.apache.org
Enviado: jue,20 mayo, 2010 10:45
Asunto: Re: EL Expression and Velocity templates

2010/5/20 Xabier Burgos Gimeno <xa...@yahoo.es>:
> No use, I get "$tiles.render($styleSheet)" rendered. It makes no difference if I use type="string" or type="velocity" .

Good, so it works then? If yes, I'm glad of having helped :-)

Antonio



      

Re: EL Expression and Velocity templates

Posted by Antonio Petrelli <an...@gmail.com>.
2010/5/20 Xabier Burgos Gimeno <xa...@yahoo.es>:
> No use, I get "$tiles.render($styleSheet)" rendered. It makes no difference if I use type="string" or type="velocity" .

Good, so it works then? If yes, I'm glad of having helped :-)

Antonio

Re: EL Expression and Velocity templates

Posted by Xabier Burgos Gimeno <xa...@yahoo.es>.
No use, I get "$tiles.render($styleSheet)" rendered. It makes no difference if I use type="string" or type="velocity" .



----- Mensaje original ----
De: Antonio Petrelli <an...@gmail.com>
Para: users@tiles.apache.org
Enviado: mié,19 mayo, 2010 20:36
Asunto: Re: EL Expression and Velocity templates

2010/5/19 Xabier Burgos Gimeno <xa...@yahoo.es>:
>           <add-attribute
> expression="${requestScope.url}/css/jquery-ui.css" type="velocity"/>

Use type="string"

> $tiles.importAttribute({"name":"styleSheets"})
> #foreach($styleSheet in $styleSheets)
>            <link type="text/css"
> rel="stylesheet" href="${styleSheet.value}"/>
> #end

Do this:
<link type="text/css" rel="stylesheet" href="$tiles.render($styleSheet)"/>

HTH
Antonio



      

Re: EL Expression and Velocity templates

Posted by Antonio Petrelli <an...@gmail.com>.
2010/5/19 Xabier Burgos Gimeno <xa...@yahoo.es>:
>           <add-attribute
> expression="${requestScope.url}/css/jquery-ui.css" type="velocity"/>

Use type="string"

> $tiles.importAttribute({"name":"styleSheets"})
> #foreach($styleSheet in $styleSheets)
>            <link type="text/css"
> rel="stylesheet" href="${styleSheet.value}"/>
> #end

Do this:
<link type="text/css" rel="stylesheet" href="$tiles.render($styleSheet)"/>

HTH
Antonio