Hi all,
I have a a jsp page that enters the form values into the database. I
need to check if the userid entered for new signup is already taken.
If yes, then I need to show an alert and then remain on the same page.
I am unable to stay on the same page after showing the alert. Is there
a way to solve this problem?
I know that JSP runs on server and java script runs on client.
But is there any work around for this?
Manish Pandit - 14 Oct 2006 04:47 GMT
One way to do it is to retain all the form values in your action
(assuming you are using struts), and then check for userID. If already
taken, set the retained values back in the request and have the
controller render the signup page again. Code the page in a way that it
prints values from the bean that is in the request - if there is none,
it'd be empty anyway. When you do an actionMapping.findForward() do not
use redirect=true.
I know all this sounds a little complicated but if you've used or are
using struts, it is pretty straightforward.
-cheers,
Manish