I use C1.8.2 and have the following code to access the session:
<xsp:logic>HttpSession theUserSession = request.getSession(); 
String theLoginName = (String) theUserSession.getAttribute("loginName");
</xsp:logic>

marty 

> -----Original Message-----
> From: Mark S. Kent [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 16, 2001 3:06 PM
> To: [EMAIL PROTECTED]
> Subject: RE: session and xsl
> 
> 
> This is what I have in C1 in my XSP code:
> 
> <xsp:logic>
>     EmployeeData employeeData = null;
>     try
>     {
>       employeeData = (EmployeeData)session.getAttribute( "employee" );
>     }
>     catch( ClassCastException e ) {}
> 
>     Integer empID = null;
>     if( employeeData != null )
>     {
>       System.out.println( "Data ID: " + 
> employeeData.getEmployee_id() );
>       empID = employeeData.getEmployee_id();
>     }
>     else
>     {
>       System.out.println( "Data ID: none" );
>       empID = new Integer( -1 );
>     }
> </xsp:logic>
> 
> The line:
> 
>       employeeData = (EmployeeData)session.getAttribute( "employee" );
> 
> is exactly how I do it in my JSP pages.  When I test for "null" on the
> employeeData object, however, it is always "null".  It may be a C1
> limitation.  We are looking at C2 because of the additional features.
> 
> Is there a "request" object for the session variable?  
> Currently I retrieve
> session variables as above and have only done "requests" for form/URL
> variables.
> 
> Mark
> 
> -----Original Message-----
> From: Christian Haul [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 16, 2001 1:35 PM
> To: [EMAIL PROTECTED]; Mark Kent
> Subject: Re: session and xsl
> 
> 
> On 16.Oct.2001 -- 09:14 AM, Mark S. Kent wrote:
> > I also have an interest on retrieving session values in my 
> XML file to
> help
> > build the XML data.  I thought that XSP would be able to 
> read them as my
> JSP
> > pages do since both run under Tomcat, but am having trouble 
> seeing them
> from
> > the XML document.
> 
> Mark, accessing session attributes from XSP ist piece of cake :-)
> There's a logicsheet aka taglib for it. Otherwise use the request
> object and access the data through ordinary java.
> 
> > Chris, is the solution you mention below only available in C2?
> 
> Which one of the two alternatives? Honestly, I don't know about C1,
> there might be a session taglib but passing parameters from a non
> existant sitemap won't do :-)
> 
> 
> > From: Christian Haul [mailto:[EMAIL PROTECTED]]
> > On 15.Oct.2001 -- 04:35 PM, Mohamed Ramzy wrote:
> > > hi all,
> > > i'm trying to read session variables through .xsl
> > > file, if you have any idea how to do that, please tell
> >
> > No way. At least from a stylesheet. Pass parameters from sitemap
> > instead. For a taglib, just use session taglib within your taglib.
> 
>       Chris.
> 
> --
> C h r i s t i a n       H a u l
> [EMAIL PROTECTED]
>     fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08
> 
> 
> ---------------------------------------------------------------------
> 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]>
> 
> 

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