Submitting data to servlet using http post

Data sent using http post method is not visible at browser address bar index.jsp

Register.java

Sending data to servlet using http get method

Gererally http get is used to get information from server, but for getting specific information based on id or user name or based on query string we send id,user name or search term query to server. Here we have created a form tag and two text box to take input age and name from user. … Read more

Servlet url and class mapping using web.xml

We can map url pattern with servlet class at web.xml. Following example will illustrate this. Project directory structure is as below: index.jsp

web.xml

Welcome1.java

In web.xml url pattern(welcome1) will match to a logical name(welcome) that logical name is matched with servlet fully qualified class name(ebhor.servlet.Welcome1). Result:

Servlet Annotation WebServlet Example

First example to show Servlet Welcome. For this we have created index.html page on index.html we have created a link. on click at link it will call welcome servlet. Our project directory structure is as below index.jsp

Welcome.java

@WebServlet(name = “Welcome”, urlPatterns = {“/welcome”}) here urlPattern maps /welcome to Welcome.java. <a href=”welcome”>Show welcome … Read more