Help: jsp + servlet | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help: jsp + servlet

i am trying to make a form. There are two button login and registration. one button will lead to one servlet and another button will lead to another servlet. But i think..we can use one submit button in a form. so how can i use another submit button which will lead to a servlet class?

27th Mar 2017, 2:42 PM
Somnath Ghosh
Somnath Ghosh - avatar
1 Answer
0
first of all it might be easier to separate thoose forms but anyway when you click on one of thoose buttons and stop the default event (event.preventDefault()) if you clicked on the button for the login, change the action attribute of your form to the page you want to get redericted to. now select your form with js-dom and call the submit () function and you are done
12th Apr 2017, 5:18 AM
Daniel S
Daniel S - avatar