You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christian Joelly <ch...@knapp.com> on 2002/03/12 11:14:44 UTC

[C2.0.1] session:set-attribute

Hello!

can session attributes only be set through the sitemap? if i look at the
generated java code, i think it is impossible to set session attributes
from java variables or from an string object...

<session:set-attribute name="report"><xsp:expr>sReport</xsp:expr></session:set-attribute>

XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf("report"), "sReport");

Chris

-- 
KNAPP Logistics Automation  http://www.knapp.com
Ing. Christian Jölly        Tel/FAX: (++43) 316 / 495 1926 / 495 394
Günter-Knapp-Straße 5-7     A-8075 Hart bei Graz


Re: [C2.0.1] session:set-attribute

Posted by Tim Myers <ph...@stserv.hcf.jhu.edu>.
With any luck, they point to the same namespace.
The uri is the namespace-- not the prefix.

whatever the prefix is,
it just needs to match "http://apache.org/xsp/session/2.0" i think.


I think cocoon1 tended to use request:whatever and session:whatever,
but that wouldn't have anything to do with your problem.  Actually, i
use session in my xsp's too instead of xsp-session.  I think the sample
was written using session as the prefix.  the logic sheet happens to use
xsp-session.  It makes no difference.

Tim


On Tue, Mar 12, 2002 at 01:43:08PM +0100, Christian Joelly wrote:
> Hi Tim!
> 
> On Tue, Mar 12, 2002 at 05:35:41AM -0500, Tim Myers wrote:
> > 
> > I can't find XSPRequestHelper.setSessionAttribute
> > 
> > I haven't update cvs in more than a week,
> > but here's what i see in the relavent template:
> > 
> >   <xsl:template match="xsp-session:set-attribute">
> >     <xsl:variable name="name">
> >       <xsl:call-template name="value-for-name"/>
> >     </xsl:variable>
> >     <xsl:variable name="content">
> >       <xsl:call-template name="get-nested-content">
> >         <xsl:with-param name="content" select="."/>
> >       </xsl:call-template>
> >     </xsl:variable>
> >     <xsp:logic>
> >       request.getSession().setAttribute(
> >           String.valueOf(<xsl:copy-of select="$name"/>),
> >           <xsl:copy-of select="$content"/>);
> >     </xsp:logic>
> >   </xsl:template>
> > 
> > You certainly should be able to set session attributes.  Try putting
> > ( ) around sReport like <xsp:expr>(sReport)</xsp:expr>
> > 
> > I'm not promising anything, but it works for me.
> 
> hmm. i tried the following:
> 
> <session:set-attribute name="report">
> 	<xsp:content><xsp:expr>sReport</xsp:expr></xsp:content>
> </session:set-attribute>
> 
> and it also works :o) 
> 
> BUT: i have the following template:
> 
> <xsl:template match="session:set-attribute">
>     <xsl:variable name="name">
> 		<xsl:call-template name="value-for-name"/>
> 	</xsl:variable>
> 
> 	<xsl:variable name="content">
> 		<xsl:call-template name="get-nested-content">
> 			<xsl:with-param name="content" select="."/>
> 		</xsl:call-template>
> 	</xsl:variable>
> 
> 	<xsp:logic>
> 		XSPRequestHelper.setSessionAttribute(objectModel,
> 		String.valueOf(<xsl:copy-of select="$name"/>),
> 		<xsl:copy-of select="$content"/>
> 		);
> 	</xsp:logic>
> </xsl:template>
> 
> 
> whats the difference between "xsp-session" and "session"? are this only
> different named xml namespaces or different taglibs?  (#+?§$%& ;))
> 
> Chris
> 
> btw: the version of cocoon i use is the distribution 2.0.1 dated 31-Jan-2002.
> 
> -- 
> KNAPP Logistics Automation  http://www.knapp.com
> Ing. Christian Jölly        Tel/FAX: (++43) 316 / 495 1926 / 495 394
> Günter-Knapp-Straße 5-7     A-8075 Hart bei Graz
> 



---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: [C2.0.1] session:set-attribute

Posted by Vadim Gritsenko <va...@verizon.net>.
Ahem. Let's put it this way: Versions you are using are different. Old
one has some bugs. New one was refactored a little bit, plus bug-fixed.

Vadim

> -----Original Message-----
> From: Christian Joelly [mailto:christian.joelly@knapp.com]
> Sent: Tuesday, March 12, 2002 7:43 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: [C2.0.1] session:set-attribute
> 
> Hi Tim!
> 
> On Tue, Mar 12, 2002 at 05:35:41AM -0500, Tim Myers wrote:
> >
> > I can't find XSPRequestHelper.setSessionAttribute
> >
> > I haven't update cvs in more than a week,
> > but here's what i see in the relavent template:
> >
> >   <xsl:template match="xsp-session:set-attribute">
> >     <xsl:variable name="name">
> >       <xsl:call-template name="value-for-name"/>
> >     </xsl:variable>
> >     <xsl:variable name="content">
> >       <xsl:call-template name="get-nested-content">
> >         <xsl:with-param name="content" select="."/>
> >       </xsl:call-template>
> >     </xsl:variable>
> >     <xsp:logic>
> >       request.getSession().setAttribute(
> >           String.valueOf(<xsl:copy-of select="$name"/>),
> >           <xsl:copy-of select="$content"/>);
> >     </xsp:logic>
> >   </xsl:template>
> >
> > You certainly should be able to set session attributes.  Try putting
> > ( ) around sReport like <xsp:expr>(sReport)</xsp:expr>
> >
> > I'm not promising anything, but it works for me.
> 
> hmm. i tried the following:
> 
> <session:set-attribute name="report">
> 	<xsp:content><xsp:expr>sReport</xsp:expr></xsp:content>
> </session:set-attribute>
> 
> and it also works :o)
> 
> BUT: i have the following template:
> 
> <xsl:template match="session:set-attribute">
>     <xsl:variable name="name">
> 		<xsl:call-template name="value-for-name"/>
> 	</xsl:variable>
> 
> 	<xsl:variable name="content">
> 		<xsl:call-template name="get-nested-content">
> 			<xsl:with-param name="content" select="."/>
> 		</xsl:call-template>
> 	</xsl:variable>
> 
> 	<xsp:logic>
> 		XSPRequestHelper.setSessionAttribute(objectModel,
> 		String.valueOf(<xsl:copy-of select="$name"/>),
> 		<xsl:copy-of select="$content"/>
> 		);
> 	</xsp:logic>
> </xsl:template>
> 
> 
> whats the difference between "xsp-session" and "session"? are this
only
> different named xml namespaces or different taglibs?  (#+?§$%& ;))
> 
> Chris
> 
> btw: the version of cocoon i use is the distribution 2.0.1 dated
31-Jan-2002.
> 
> --
> KNAPP Logistics Automation  http://www.knapp.com
> Ing. Christian Jölly        Tel/FAX: (++43) 316 / 495 1926 / 495 394
> Günter-Knapp-Straße 5-7     A-8075 Hart bei Graz



---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: [C2.0.1] session:set-attribute

Posted by Christian Joelly <ch...@knapp.com>.
Hi Tim!

On Tue, Mar 12, 2002 at 05:35:41AM -0500, Tim Myers wrote:
> 
> I can't find XSPRequestHelper.setSessionAttribute
> 
> I haven't update cvs in more than a week,
> but here's what i see in the relavent template:
> 
>   <xsl:template match="xsp-session:set-attribute">
>     <xsl:variable name="name">
>       <xsl:call-template name="value-for-name"/>
>     </xsl:variable>
>     <xsl:variable name="content">
>       <xsl:call-template name="get-nested-content">
>         <xsl:with-param name="content" select="."/>
>       </xsl:call-template>
>     </xsl:variable>
>     <xsp:logic>
>       request.getSession().setAttribute(
>           String.valueOf(<xsl:copy-of select="$name"/>),
>           <xsl:copy-of select="$content"/>);
>     </xsp:logic>
>   </xsl:template>
> 
> You certainly should be able to set session attributes.  Try putting
> ( ) around sReport like <xsp:expr>(sReport)</xsp:expr>
> 
> I'm not promising anything, but it works for me.

hmm. i tried the following:

<session:set-attribute name="report">
	<xsp:content><xsp:expr>sReport</xsp:expr></xsp:content>
</session:set-attribute>

and it also works :o) 

BUT: i have the following template:

<xsl:template match="session:set-attribute">
    <xsl:variable name="name">
		<xsl:call-template name="value-for-name"/>
	</xsl:variable>

	<xsl:variable name="content">
		<xsl:call-template name="get-nested-content">
			<xsl:with-param name="content" select="."/>
		</xsl:call-template>
	</xsl:variable>

	<xsp:logic>
		XSPRequestHelper.setSessionAttribute(objectModel,
		String.valueOf(<xsl:copy-of select="$name"/>),
		<xsl:copy-of select="$content"/>
		);
	</xsp:logic>
</xsl:template>


whats the difference between "xsp-session" and "session"? are this only
different named xml namespaces or different taglibs?  (#+?§$%& ;))

Chris

btw: the version of cocoon i use is the distribution 2.0.1 dated 31-Jan-2002.

-- 
KNAPP Logistics Automation  http://www.knapp.com
Ing. Christian Jölly        Tel/FAX: (++43) 316 / 495 1926 / 495 394
Günter-Knapp-Straße 5-7     A-8075 Hart bei Graz


Re: [C2.0.1] session:set-attribute

Posted by Tim Myers <ph...@stserv.hcf.jhu.edu>.
I can't find XSPRequestHelper.setSessionAttribute

I haven't update cvs in more than a week,
but here's what i see in the relavent template:

  <xsl:template match="xsp-session:set-attribute">
    <xsl:variable name="name">
      <xsl:call-template name="value-for-name"/>
    </xsl:variable>
    <xsl:variable name="content">
      <xsl:call-template name="get-nested-content">
        <xsl:with-param name="content" select="."/>
      </xsl:call-template>
    </xsl:variable>
    <xsp:logic>
      request.getSession().setAttribute(
          String.valueOf(<xsl:copy-of select="$name"/>),
          <xsl:copy-of select="$content"/>);
    </xsp:logic>
  </xsl:template>

You certainly should be able to set session attributes.  Try putting
( ) around sReport like <xsp:expr>(sReport)</xsp:expr>

I'm not promising anything, but it works for me.

On Tue, Mar 12, 2002 at 11:14:44AM +0100, Christian Joelly wrote:
> Hello!
> 
> can session attributes only be set through the sitemap? if i look at the
> generated java code, i think it is impossible to set session attributes
> from java variables or from an string object...
> 
> <session:set-attribute name="report"><xsp:expr>sReport</xsp:expr></session:set-attribute>
> 
> XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf("report"), "sReport");
> 
> Chris
> 
> -- 
> KNAPP Logistics Automation  http://www.knapp.com
> Ing. Christian Jölly        Tel/FAX: (++43) 316 / 495 1926 / 495 394
> Günter-Knapp-Straße 5-7     A-8075 Hart bei Graz
> 



---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>