cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <>
Subject RE: Session in xsp page- information
Date Wed, 11 Oct 2000 18:02:57 GMT
"Terry Paddy" <> wrote:
>Hi all,
>I'm trying to use the appropriate logic sheets for managing sessions,
>requests etc. I can't seem to place a "variable" in the session object.
>I know the session is "active" as I have <xsp:page
>   language="java" create-session="true" .... and I have successfully
>retrieved the session ID with <session:get-id> and also checked
><session:is-new as='string'>
>What I can't seem to be able to do is set a variable with ...
><session:put-value name='thisuser'>myUserName</session:put-value>

Try session:set-attribute. However this calls the setAttribute method which 
was introduced in Servlet 2.2 API, so it won't work on a pre-2.2 engine like 

Really it's a minor bug that there is no JServ-compatible tag. This will be 
fixed in CVS soon. But it's really easy to fix yourself. Just add this to 
src/org/apache/cocoon/processor/xsp/library/java/session.xsl and rebuild 

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

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

        String.valueOf(<xsl:copy-of select="$name"/>),
        <xsl:copy-of select="$content"/>

>What I would ultimately like to do, and I have not been able to try it yet,
>is ...
><esql:query>select * from register where reg_user='<request:get-parameter
>   <esql:results>
>    <validuser><esql:get-string column='reg_empid'/></validuser>
>    <session:put-value name='thisuser'><esql:get-string
>   </esql:results>
>	.
>	.
>	.
>Is that going to be possible?

Yes, I should think so - that's exactly the kind of thing the ESQL taglib 
was designed for.

Get Your Private, Free E-mail from MSN Hotmail at

Share information about yourself, create your own public profile at

View raw message