cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <gree...@hotmail.com>
Subject RE: Session in xsp page- information
Date Wed, 11 Oct 2000 18:02:57 GMT
"Terry Paddy" <terry@rostersetc.com> 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 
JServ.

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 
cocoon.

  <xsl:template match="session:put-value">
    <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>
      session.putValue(
        String.valueOf(<xsl:copy-of select="$name"/>),
        <xsl:copy-of select="$content"/>
      );
    </xsp:logic>
  </xsl:template>


>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
>name='p1'/>'</esql:query>
>
>   <esql:results>
>    <validuser><esql:get-string column='reg_empid'/></validuser>
>    <session:put-value name='thisuser'><esql:get-string
>column='reg_empid'/></session:put-value>
>   </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 http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


Mime
View raw message