cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zeljko Rajic <zeljko.ra...@brokat.com>
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:

<xsp:logic>
   MyObject theInstance = new MyObject();
</xsp:logic>


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>

or:

<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
!!</xsp:content></xsp-session:set-attribute>


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

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


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. <http://xml.apache.org/cocoon/faqs.html>

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


Mime
View raw message