Hi Richard

Yes I can do that - but the problem is that 'listIndex' does not
logically belong to the Student ActionForm - it is more an external
info.

Rivka

-----Original Message-----
From: Richard Yee [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 06, 2005 6:20 PM
To: Struts Users Mailing List
Subject: Re: request attribute in jsp - please advice

Can you set the listIndex as an attribute of your form
in the EditStudentAction? You can then retrieve it as
part of your formBean.


-Richard


--- Rivka Shisman <[EMAIL PROTECTED]> wrote:

> Hello friends
> 
> I have an EditStudent.jsp page in which I have a
> form. Before the form
> tag I get a request attribute called 'listIndex'.
> But, when my
> validate() method fails on field validation it
> returns back to the above
> mentioned jsp page with an appropriate message. That
> is o.k. - the
> problem is that this causes the removal of the
> request attribute that
> was originally set by the EditStudentAction.
> 
> So what I do now in the jsp page is something like
> this:
> 
> <% int listIndex = 0;
> 
>       If (request.getAttribute("index") != null){
> 
>             listIndex =
> request.getAttribute("index");
> 
>       }else{
> 
>              If (request.getParameter("myIndex") !=
> null){
> 
>                         listIndex =
> request.getParameter("myIndex");
> 
>             }
> 
> %>
> 
> And then under the <html:form> I have an hidden
> input like:
> 
> <INPUT type="hidden" name="myIndex" value=<%
> =listIndex%> 
> 
> When the validate{} fails the -
> getParameter("myIndex") - enables me to
> restore my request attribute via the hidden
> parameter.
> 
> Do you know a nicer way to do it?
> 
>  
> 
> Thanks
> 
> Rivka
> 
>  
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



        
                
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/

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