Hi, Ia displaying one jsp which is accessing some parametres (was setting in request attribute) like HashMap.Assume this page is having 10 check boxes, user clicks on 5 check boxes and will click on submit. Now after clicking on submit button in this page, the control will move to some action class to process some operation but user should be viewing that same page (the checkboxes status should remain same as he selected). I am passing control to action class and processing some operation and then trying to revisit the page, but its showing NullPointerException since it needs some parameters (there is request.getParameter() method). Whats the solution to this problem. Pls reply ur valuble suggestions. Thanks.
You mean accessing attributes (i.e. request.getAttribute("myHashMap")), not parameters, right? You can't have a HashMap in a request parameter.
A few possibilities:
1. Put the attributes in the session instead of the request.
Joined: May 09, 2005
Thanks for your reply. I understood ur first point, but we are not supposed to maintain sessions according to application requirement. Pls tell me the alternate way. I didnt understood ur second point, pls tell me clearly. Thanks once again.
Joined: Dec 13, 2004
You say that you don't want the page viewed by the user to change - do you mean you just want the submit to happen, but the user will not see anything change at all on the page, aside from maybe a "Submission successful" type message?
In this case you could use a hidden iframe:
Note that if there's a problem on the server side (even if test.jsp is not found) you'll still get the alert that the form was submitted. If that's not desirable, you can have the iframe's onload call a function that check's its contents.