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 is called a session?
Difference between httpservlet and generic servlets?
What is the process for chaining servlet?
What is the disadvantage of cookies?
Why the container loads server at the application startup and how?
What is MIME Type?
Which java framework is most popular?
Why HttpServlet class is declared abstract?
How to commuincate between an applet and a servlet?
Can we override destroy method in servlet?
List some life cycle methods of a servlet.
How to get ip address in jsp login page and how to validate like 127.1.0.1 all should not be greater than 255
How to get the current httpsession object?
How we can get ip address of client in servlet?
What is Servlet API used for connecting database?