Answer Posted / chandra kunchala
you can invoke the servlet by two ways
one is dierctly u can invoke from address bar
like the following
http://<servername>:<port-Number>/<web-application-name>/<url-pattern
of perticular servlet>
eg:- http://localhost:8080/app1/test
second one is u can invoke by using form..
<form action="/app1/test">
.....
.....
</form>
web.xml:-
<servlet>
<servlet-name>FirstServlet</servlet-name>
<servlet-class>pack1.pack2.ClassName</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FirstServlet</servlet-name>
<url-pattern>/test</url-pattern>(test should be equal
to what u typed in the address bar after the web-application
name or should be equal to what u mention in the form action
after the web-application name)
</servlet-mappin>
| Is This Answer Correct ? | 16 Yes | 7 No |
Post New Answer View All Answers
Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?
What are the drawbacks of cgi?
What is the difference between get and post methods?
How to make sure a servlet is loaded at the application startup?
What are the different ways we can maintain state between requests?
Whats the advantages using servlets over using CGI?
What are the different methods involved in generic servlet?
Define the lifecycle for executing a jsp page.
What is a server side include (ssi)
What is difference between the HTTP Servlet and Generic Servlet? Explain about their methods and parameters?
What is the capacity the doget can send to the server?
What do you mean by singlethreadmodel interface?
How we can get ip address of client in servlet?
What do you mean by the servlet chaining?
What is difference between jsp and servlet?