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
What methods do you use in servlet - applet communication?
How can the referrer and the target urls be used in servlet?
How to make sure a servlet is loaded at the application startup?
What is the difference between encodeRedirectUrl and encodeURL?
If a servlet is not properly initialized, what exception may be thrown?
Which HTTP method is non-idempotent?
Explain how does JSP handle run-time exceptions?
What is the purpose of inter-servlet communication?
Tell us something about servletcontext interface.
How a servlet is unloaded?
Explain the methods of request dispatcher in servlet?
Explain get and post.
How is the get () method different from the post() method?
What is the major difference between context parameter and context attribute?
Which interface should be implemented by all servlets?