here is what i have to do:
1. create a jsp with two text fields that take numbers only. DONE.
2. Validate the fields, if any of the field's data invalid, goto a error jsp display a message and a button or link that will lead back to the first jsp with only the valid data remaining in the field and empty the invalid field.
How do i do the last part of No.2? i use filter to validate the fields, but i just don't know how to go back to the first jsp with the valid data remaining in the field.
thanks for your time and help!
Comments
:
: 1. create a jsp with two text fields that take numbers only. DONE.
:
: 2. Validate the fields, if any of the field's data invalid, goto a error jsp display a message and a button or link that will lead back to the first jsp with only the valid data remaining in the field and empty the invalid field.
:
: How do i do the last part of No.2? i use filter to validate the fields, but i just don't know how to go back to the first jsp with the valid data remaining in the field.
:
: thanks for your time and help!
it's not too difficult all the thing you should do :
first you submit your text fields values to a jsp or servelet for processing the validation and at there you do like this:
...
String x = request.getParameter("textField1");
String y = request.getParameter("textField2");
....
//doinig your validating
....
//we assume x is correct and y is not
if(x is valid)
request.setAttribute("myValidField",x);
...
RequestDispatcher dispatcher = request.getRequestDispatcher("/yourFirstJSP page");
dispatcher.forward()
....
//and in your first jsp do like this
">
....
it is done!
I've already checked this.