You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Patrick Hess <pa...@ish.de> on 2003/11/04 11:38:20 UTC
problem: JXTemplate Generator
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
passing session context data
Posted by julien bloit <Ju...@ircam.fr>.
Hi all,
I have an application in which a non-authenticated user collects a set of
items from a catalog (shopping-cart like), and stores the item list in the
context of the session. I use the session taglib and the session transformer
to do so.
To proceed to the cart command, the user logs in. I use the the
DatabaseAuthenticatorAction to do so. This creates a new session for the
user.
I'm trying to figure out how to pass the shopping-cart context from the
unauthenticated session to the authenticated one. But I have trouble seeing
how it can be done : is the previous session terminated as soon the user
authenticates? How can I track info from another session?
Many thanks for your thoughts!!
These are the concerned parts of my sitemap :
<!-- ______________ Add items to cart _______________ -->
<map:pipeline>
<map:match pattern="ajout/*">
<map:generate src="panier/panier.xml"/>
<map:transform src="xsl/create_context.xsl">
<map:parameter name="item_id" value="{1}"/>
</map:transform>
<map:transform type="session"/>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>
<!-- ______________ See cart content _______________ -->
<map:pipeline>
<map:match pattern="consult">
<map:generate type="serverpages" src="panier/consult.xsp"/>
<map:transform type="session"/>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>
<!-- ______________ Authentication _______________ -->
<map:pipeline>
<map:match pattern="login">
<map:act type="authenticator">
<map:parameter name="descriptor"
value="context://dvdcarte/defs/auth-def.xml"/>
<map:redirect-to uri="perso_accueil"/>
</map:act>
<map:redirect-to uri="login.html"/>
</map:match>
</map:pipeline>
<!-- ______________ Protected area _______________ -->
<map:pipeline>
<map:match type="sessionstate" pattern="*">
<map:parameter name="attribute-name" value="userId"/>
<map:match pattern="perso_accueil">
<map:generate type="serverpages" src="xsp/perso_accueil.xsp"/>
<map:serialize type="html"/>
</map:match>
</map:match>
</map:pipeline>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: problem: JXTemplate Generator
Posted by Christopher Oliver <re...@verizon.net>.
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