How can I call a servlet from the form’s action without using the web.xml deployment descriptor?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Upgrade to Java EE 6 / Servlet 3.0, then you’ll be able to register the servlet by the
@WebServletannotation.No need for
web.xmlanymore. The above does basically the same as following:As far now you can choose from under each Glassfish v3 and Tomcat 7 as Servlet 3.0 implementations.
Prior to Servlet 3.0 your best bet is likely the front controller pattern. Have a single servlet in
web.xmlwhich delegates requests/actions to domain objects based on the request parameters and/or pathinfo. This is also used in the average MVC framework.