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

Reply via email to