cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <res1c...@verizon.net>
Subject Re: problem: JXTemplate Generator
Date Tue, 04 Nov 2003 17:23:32 GMT
Try this:

<data>${session.getAttribute("myBean").getUserName()}</data>

The "session" object is of type org.apache.cocoon.environment.Session.

See 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/environment/Session.html.

Chris

Patrick Hess wrote:

>
> Hi!
>
> I'm trying to work this JXTemplate generator but it seems I'm missing 
> something...
>
> This is my pipeline:
>
>     <map:match pattern="realm">
>         <map:generate src="config/realms.xml" type="jx" />
>         <map:serialize type="xml"/>
>     </map:match>
>
> realms.xml looks like this:
>
>     <realms xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
>         <realm id="default">
>         <data>${session.myBean.getUserName()}</data>
>         </realm>
>         <realm id="service">
>         <data>${session.myBean.getUserName()}</data>
>         </realm>
>     </realms>
>
> My result is always something like
>
>     ...
>     <data></data>
>     ...
>
> so I guess the expression is substituted (by an empty string).
> Then I changed my realms.xml: (taken from cocoon website)
>
>     ...
>     <data>
>         <jx:set var="greeting" value="Hello World"/>
>         The value of greeting is ${greeting}
>     </data>
>     ...
>
> and got
>
>     <data>The value of greeting is</data>
>
>
> Q1) Is this ${session.myBean.getUserName()} correct to get the result
>     of the getUserName() method in class myBean stored in the session?
>
> Q2) What is wrong with my version using <jx:set>?
>
> So if anybody can me I would be very happy... :-) Thanks...
>
> Patrick
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message