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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to