Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

java web application (text fields) NEED HELP!

rmarma Member Posts: 7
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

  • amigo77amigo77 Member Posts: 10
    : 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!

    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.
Sign In or Register to comment.