Of course setAttribute returns null: it's return type is void. See the HttpSession class javadocs at:
http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpSession.html

Plus, if you are accessing it in your JSP as "${usr.names}" that says it was set using getAttribute("usr", yourObject) so to find it inside your Action you need the right variable name "usr" like this: BeanUsr usr = (BeanUsr)getContext().getRequest().getSession().getAttribute("usr");

Regards,
David

Farouk Alhassan wrote:
The stripes action is far later and that is when the action bean is initialised. The stripes action only sets a value of the bean.

***getContext().getRequest().getSession().setAttribute("BeanUsr", new BeanUsr()); returns null

but value="${usr.names}" returns the names
*
Yea the object was cast.
thnx 4 the help.



    ------------------------------------------------------------------------
    Date: Mon, 7 Apr 2008 19:52:17 +0100
    From: [EMAIL PROTECTED]
    To: [email protected]
    Subject: Re: [Stripes-users] Accessing HttpSession stripes

    Have you tried to set this attribute just before getting it... to
    ensure there is nothing in between to interfere? Also I've added a
    typecast when you get attribute object from session...
e.g.
    *1.
    **getContext().getRequest().getSession().setAttribute("BeanUsr",
    new BeanUsr());
    *2. BeanUsr usr =
    (BeanUsr)getContext().getRequest().getSession().getAttribute("BeanUsr");


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to