struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <mark.l...@talk21.com>
Subject Re: NullPointer exception
Date Wed, 23 Jul 2003 09:23:43 GMT
I had to use the scope attribute on the action tag in struts-config.xml

Which i thought would only be to scope the form bean, defined by the 
name attribute but it would appear not.

Btw, thanks for the "best practice" tip.. When's the book comming out ;)

Cheers Mark

On Wednesday, July 23, 2003, at 09:55 AM, Andrew Hill wrote:

> <snip>
> Now there appears to be something setting the request to
> null between actions, I just have no idea what.
> </snip>
>
> Well of course the request attributes are null (i presume its the 
> request
> attribute thats null and not the request reference itself!) in the 
> second
> action. Unless you do a server-side redirect direct to it from the 
> first
> action (which Im assuming your not - unless your doing action chaining
> (which is bad)) then you will be hitting it as a result of a *new* 
> request
> from the browser.
>
> <snip>
> This sort of thing really should be happening
> </snip>
>
> Ahh... glad you recognise that ;-) but it should not be happening for 
> the
> session.
>
> Im not sure why you are having problems getting it out of the session. 
> It
> could be that your session tracking isnt working properly. Check that 
> you
> either have cookies enabled in your browser, or if not that you are
> rewriting any urls that need it. (In the case of a forms action url 
> this
> will be done automaticlly by the struts html:form tag) (- its 
> considered
> best practice for your application to be able to work without cookies 
> btw -
> which makes url rewriting in your pages essential.)
>
> -----Original Message-----
> From: Mark Lowe [mailto:mark.lowe@talk21.com]
> Sent: Wednesday, 23 July 2003 16:44
> To: Struts List
> Subject: NullPointer exception
>
>
> Before I wash anymore time out on stuff that really shouldn't happen,
> may I ask if anyone else has had problems with anything being stored in
> the request and/or session returning null..
>
> for example imagine i've 2 actions
>
> // in action 1
>
> HttpSession session = request.getSession()
> session.setAttribute("test","mellow");
> mapping.findForward("success");
>
> //action 2
>
> HttpSession session = request.getSession();
> //Next line returns null
> String str = session.getAttribute("test").toString();
> mapping.findForward("success");
>
> I've tried the same with request rather than session, but I keep
> getting null.. Now there appears to be something setting the request to
> null between actions, I just have no idea what. This sort of thing
> really should be happening, has anyone else got this problem?
>
> Request nor session will even let be get a string from it!!!
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message