Problem with alert in JSP

M

mohammed.naghman

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?
 
M

Manish Pandit

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,085
Members
48,773
Latest member
Kaybee

Latest Threads

Top