Hi,

      I don't know but... Can you put a hidden field into form with the
value of attribute? Maybe solve your problem...






                                                                                
                                                       
                      "Rivka Shisman"                                           
                                                       
                      <[EMAIL PROTECTED]        To:       "Struts Users Mailing 
List" <user@struts.apache.org>                          
                      l>                       cc:                              
                                                       
                                               bcc:                             
                                                       
                      06/09/2005 18:27         Subject:  request attribute in 
jsp - please advice                                      
                      Please respond to                                         
                                                       
                      "Struts Users                                             
                                                       
                      Mailing List"                                             
                                                       
                                                                                
                                                       
                                                                                
                                                       
                                                                                
                                                       
                                                                                
                                                       
                                                                                
                                                       




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]







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

Reply via email to