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:hidden name="myIndex" value=<% =listIndex%>

 

When the validate{} fails the getParameter enables me to restore my
request attribute via the hidden parameter.

 

Do you know a nicer way to do it?

 

Thanks

Rivka

 

Reply via email to