You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Whittaker <mi...@ntlworld.com> on 2003/05/30 02:31:26 UTC

null request attribute - easy one?

Terribly numpty problem!

I have subclassed the RequestProcessor and set a request attribute there, in
the Action I've checked to see if it is still there, it is.
When I forward to a jsp page it is null.

Where may I be going wrong please?

Also is there a struts way to do:

<%= (String)request.getAttribute("time") %>

Thankyou

--
Mike W


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


RE: null request attribute - easy one?

Posted by Mike Whittaker <mi...@ntlworld.com>.
>
>A struts forward can be redirecting or non-redirecting. Check if you are
>using a redirecting one (look at whats in your struts config for that
>forward) - redirecting ones cause a client side redirection so you start a
>new request.
>

No Andrew, that didn't work, redirect attribute is false by default, I set
it to that anyway, no difference.  I did try the session approach Mark
suggested, and that works as you'd expect.
This is wierd, what is Struts doing differently?

At the moment I just have a simple forward to get a jsp form and then the
action it is sent to forwards it back to the form.

--
Mike W

>
>>Terribly numpty problem!
>>
>>I have subclassed the RequestProcessor and set a request attribute
>>there, in
>>the Action I've checked to see if it is still there, it is. When I forward
>>to a jsp page it is null.
>>
>>Where may I be going wrong please?
>>
>>Also is there a struts way to do:
>>
>><%= (String)request.getAttribute("time") %>
>>
>
>>Because after it goes through the action, it's reference is
>>removed.  Set it
>>to session scope and dereference as is appropriate.
>>
>>Mark
>
>But without struts when you do a forward with a request dispatcher, request
>attributes are available to the jsp, what is struts doing differently and
>why?
>
>--
>Mike W
>
>
>---------------------------------------------------------------------
>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


RE: null request attribute - easy one?

Posted by Andrew Hill <an...@gridnode.com>.
A struts forward can be redirecting or non-redirecting. Check if you are
using a redirecting one (look at whats in your struts config for that
forward) - redirecting ones cause a client side redirection so you start a
new request.

-----Original Message-----
From: Mike Whittaker [mailto:mike_whittaker@ntlworld.com]
Sent: Friday, 30 May 2003 17:27
To: Struts Users Mailing List
Subject: RE: null request attribute - easy one?



>Terribly numpty problem!
>
>I have subclassed the RequestProcessor and set a request attribute
>there, in
>the Action I've checked to see if it is still there, it is. When I forward
>to a jsp page it is null.
>
>Where may I be going wrong please?
>
>Also is there a struts way to do:
>
><%= (String)request.getAttribute("time") %>
>

>Because after it goes through the action, it's reference is
>removed.  Set it
>to session scope and dereference as is appropriate.
>
>Mark

But without struts when you do a forward with a request dispatcher, request
attributes are available to the jsp, what is struts doing differently and
why?

--
Mike W


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


RE: null request attribute - easy one?

Posted by Mike Whittaker <mi...@ntlworld.com>.
>Terribly numpty problem!
>
>I have subclassed the RequestProcessor and set a request attribute
>there, in
>the Action I've checked to see if it is still there, it is. When I forward
>to a jsp page it is null.
>
>Where may I be going wrong please?
>
>Also is there a struts way to do:
>
><%= (String)request.getAttribute("time") %>
>

>Because after it goes through the action, it's reference is
>removed.  Set it
>to session scope and dereference as is appropriate.
>
>Mark

But without struts when you do a forward with a request dispatcher, request
attributes are available to the jsp, what is struts doing differently and
why?

--
Mike W


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


RE: null request attribute - easy one?

Posted by Mark Galbreath <ma...@qat.com>.
Because after it goes through the action, it's reference is removed.  Set it
to session scope and dereference as is appropriate.

Mark

-----Original Message-----
From: Mike Whittaker [mailto:mike_whittaker@ntlworld.com] 
Sent: Thursday, May 29, 2003 8:31 PM
To: Struts List
Subject: null request attribute - easy one?



Terribly numpty problem!

I have subclassed the RequestProcessor and set a request attribute there, in
the Action I've checked to see if it is still there, it is. When I forward
to a jsp page it is null.

Where may I be going wrong please?

Also is there a struts way to do:

<%= (String)request.getAttribute("time") %>

Thankyou

--
Mike W


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