haha.
its sometimes funny how much frustration can cause. that was all mixed up...I 
have been on this since 10am and its 10pm here. i have left work and still 
jumping from site to site looking for a solution.

this is what i intended to say: i will copy the method

  @DefaultHandler
  public Resolution convert() throws Exception{    
    LoginBean login = (LoginBean) 
getContext().getRequest().getSession().getAttribute("loginBean");
    if(login == null)System.out.println("USR IS NULL 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    init();
    if(login.isLoggedIn())
    return new ForwardResolution("/financials02.jsp");
    else
 return new ForwardResolution("/login.jsp");
  }
it keeps printing USR IS NULL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Date: Mon, 7 Apr 2008 16:22:16 -0400
From: [EMAIL PROTECTED]
To: [email protected]
Subject: Re: [Stripes-users] Accessing HttpSession  stripes






  


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");

    
    
  






_________________________________________________________________
Get Hotmail on your mobile. Text MSN to 63463 now!
http://mobile.uk.msn.com/pc/mail.aspx
-------------------------------------------------------------------------
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