You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2003/02/10 14:32:59 UTC
Accessing named session attributes in XSP?
I know I am missing something *very* obvious, but
I have "end of day" stare here, and cannot figure what
mistake I am making.
I am using the Database Authenticator to process a
login - the user ID is stored in a session attribute called
"userrname" The auth.xml used looks like:
<auth-descriptor>
<connection>myDB</connection>
<table name="user">
<select dbcol="UserName" request-param="username"
to-session="username"/>
<select dbcol="UserPassword" request-param="userpass" />
</table>
</auth-descriptor>
This process seems to be working, as I can now get
access to the protected part of the pipeline: ie.
<map:match type="sessionstate" pattern="*">
<map:parameter name="attribute-name" value="username"/>
<!-- all this is accessible after login -->
</map:match>
However, when I try and use the username attribute in
an XSP file, I just get a "null" returned - here's the snippet
from the file:
<xsp:page
language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-session="http://apache.org/xsp/request/2.0"
>
<!-- Page-level logic -->
<page>
<xsp:logic>
//session
String sUserName = <xsp-session:get-attribute name="username"
as="string"/>;
</xsp:logic>
<element><xsp:expr>sUserName</xsp:expr></element>
</page>
The <element> now contains "null" (wihtout the ")
Any idea how to get the username out into the XSP??
Thanks
Derek
--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.
"The CSIR exercises no editorial control over E-mail messages and/or
attachments thereto/links referred to therein originating in the
organisation and the views in this message/attachments thereto are
therefore not necessarily those of the CSIR and/or its employees.
The sender of this e-mail is, moreover, in terms of the CSIR's Conditions
of Service, subject to compliance with the CSIR's internal E-mail and
Internet Policy."
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
AW: Accessing named session attributes in XSP?
Posted by Marco Rolappe <m_...@web.de>.
hi derek,
could you tell me please how the XSP is accessed? the problem might be that
your XSP is dealing with a different session (XSPs default to creating a new
session).
> -----Ursprungliche Nachricht-----
> Von: cocoon-users-return-46390-m_rolappe=web.de@xml.apache.org
> [mailto:cocoon-users-return-46390-m_rolappe=web.de@xml.apache.org]Im
> Auftrag von Derek Hohls
> Gesendet: Montag, 10. Februar 2003 14:33
> An: cocoon-users@xml.apache.org
> Betreff: Accessing named session attributes in XSP?
>
>
> I know I am missing something *very* obvious, but
> I have "end of day" stare here, and cannot figure what
> mistake I am making.
>
> I am using the Database Authenticator to process a
> login - the user ID is stored in a session attribute called
> "userrname" The auth.xml used looks like:
>
> <auth-descriptor>
> <connection>myDB</connection>
> <table name="user">
> <select dbcol="UserName" request-param="username"
> to-session="username"/>
> <select dbcol="UserPassword" request-param="userpass" />
> </table>
> </auth-descriptor>
>
> This process seems to be working, as I can now get
> access to the protected part of the pipeline: ie.
>
> <map:match type="sessionstate" pattern="*">
> <map:parameter name="attribute-name" value="username"/>
> <!-- all this is accessible after login -->
> </map:match>
>
> However, when I try and use the username attribute in
> an XSP file, I just get a "null" returned - here's the snippet
> from the file:
>
> <xsp:page
> language="java"
> xmlns:xsp="http://apache.org/xsp"
> xmlns:xsp-session="http://apache.org/xsp/request/2.0"
> >
>
> <!-- Page-level logic -->
> <page>
>
> <xsp:logic>
> //session
> String sUserName = <xsp-session:get-attribute name="username"
> as="string"/>;
> </xsp:logic>
>
> <element><xsp:expr>sUserName</xsp:expr></element>
>
> </page>
>
>
> The <element> now contains "null" (wihtout the ")
>
>
> Any idea how to get the username out into the XSP??
>
> Thanks
> Derek
>
>
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
> "The CSIR exercises no editorial control over E-mail messages and/or
> attachments thereto/links referred to therein originating in the
> organisation and the views in this message/attachments thereto are
> therefore not necessarily those of the CSIR and/or its employees.
> The sender of this e-mail is, moreover, in terms of the CSIR's Conditions
> of Service, subject to compliance with the CSIR's internal E-mail and
> Internet Policy."
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>