How to get a form parameter in servlet? request.getAttribute does not work

烈酒焚心 提交于 2019-12-03 08:50:53

To get a form parameter in a servlet you use:

  request.getParameter("Email");

And yes you can use the same servlet but it would be way easier to use two different servlets to do this.

you could have the form's method set to POST and then implement a doPost() method in your servlet. the doGet() will get called to display the form and the doPost() will get called to process the form submission.

alternatively you could have the doGet() method test for the presence of any parameters. if there aren't any then just display the form. if there are then process the submission...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!