It is available for the duration of the HTTP request.
That may be more than one page if you are forwarding (server-side)
but if you are not it is more or less equivalent to a page.
The 4 scopes are
page, request, session, application

so if you want to keep something for longer
you probably want to put it in the session.

About the user clicking a button: if it is a submit button
I believe the button name is an http parameter and you can look
for that in an action.  You can also use javascript to set
a hidden field when the user clicks a button.  That is a
"parameter", not an "attribute" but you can look for the
parameter in the action and set and attibute.
- Dan

> -----Original Message-----
> From: Jim Douglas [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, December 30, 2004 12:58 PM
> To: user@struts.apache.org
> Subject: setAttribute
> 
> I set an attribute as follows...
> 
> public class AdsRespAction extends Action {
> 
>       public ActionForward execute(
>               ActionMapping mapping,
>               ActionForm Form,
>               HttpServletRequest request,
>               HttpServletResponse response)
>               throws Exception {
>               .
>                 .
>                 request.setAttribute("adlist", list);
>               return mapping.findForward("success");
>       }
> }
> 
> 
>    I can loop through the adlist attribute in a jsp and build 
> a table, no 
> problem.  How long is the adlist attribute available?  Is it 
> just for the 
> page or multiple pages?
> 
>    Also, is there a way to set an attribute value in a page 
> after the user 
> has clicked on a specfic button? (and set it equal to the 
> value of the 
> button)
> 
> Jim
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to