cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zeljko Rajic <>
Subject How to set session attribute correctly
Date Thu, 12 Jul 2001 11:56:24 GMT
Hi Cocoon users,

I'm wondering how to set a session attribute correctly using the
<xsp-session:set-attribute> tag.

For example I create an instance of an own object:

   MyObject theInstance = new MyObject();

Later in the XSP document I'd like to add this instance to the session using
the <xsp-session:set-attribute> tag. Now I'm not sure what's the correct way
to do so as there are several possibilites:

<xsp-session:set-attribute name="MyAttribute">theInstance</xsp-session:set-attribute>


<xsp-session:set-attribute name="MyAttribute"><xsp:expr>theInstance</xsp:expr></xsp-session:set-attribute>

And then, how to I correctly set a string value? Like this:

<xsp-session:set-attribute name="MyAttribute">Some text !!</xsp-session:set-attribute>

or is this the correct way:

<xsp-session:set-attribute name="MyAttribute"><xsp:content>Some text

And by the way, is this kind of expression allowed:

<xsp-session:set-attribute name="MyAttribute">
      if ( "object".equals(<xsp-request:get-parameter name="MyParam"/>)
          <xsp:content>Some Text !!</xsp:content>

Any kind of comments are welcome !!

-  Zeljko

PS: Yes I know, I could simply use the 'session.setAttribute(...)' method, but
I'd like to use the <xsp-session:set-attribute> tag.

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message