You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Rui Alberto <ru...@ptinovacao.pt> on 2005/06/13 13:18:06 UTC
JX template syntax
Hi all,
this is probably a basic question, but I can't find out how to solve my
problem.
Is that possible do something like :
<jx:set var="xxx" value="${Packages.java.util.Date}"/>
<input name="teste" type="hidden" value="#{$xxx.getTime()}
Thanks to all for any help,
Rui
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: JX template syntax
Posted by Leszek Gawron <lg...@mobilebox.pl>.
Reinhard Poetz wrote:
> Rui Alberto wrote:
>
>> Hi all,
>> this is probably a basic question, but I can't find out how to solve my
>> problem.
>>
>> Is that possible do something like :
>> <jx:set var="xxx" value="${Packages.java.util.Date}"/>
>>
>> <input name="teste" type="hidden" value="#{$xxx.getTime()}
>
>
> I don't know if you can create new objects in jxtemplate (I don't think
> so.). Whenever I had the need for it I wrote a static initializer.
Yes you can:
<jx:set var="myObject" value="${Packages.org.myproject.MyClass()}"/>
--
Leszek Gawron lgawron@mobilebox.pl
IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: JX template syntax
Posted by Reinhard Poetz <re...@apache.org>.
Rui Alberto wrote:
> Hi all,
> this is probably a basic question, but I can't find out how to solve my
> problem.
>
> Is that possible do something like :
> <jx:set var="xxx" value="${Packages.java.util.Date}"/>
>
> <input name="teste" type="hidden" value="#{$xxx.getTime()}
I don't know if you can create new objects in jxtemplate (I don't think so.).
Whenever I had the need for it I wrote a static initializer.
For your problem you can write
<input name="teste" type="hidden"
value="${Packages.java.lang.System.currentTimeMillis()}"/>
or you write a static helper method that returns a Date object.
Anyway, be aware that this isn't good design to create objects in the view layer
- it's better to push them to it.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org