Answer Posted / dara
<form action="/servlet/full.class.name">
</form>
This method uses the invoker servlet, provided by many
servlet containers. The much better way of invoking a
servlet is by providing an explicit mapping for it. This is
accomplished by using a pair of tags in your web
application's web.xml file. This is not the same file as
mentioned above. That file was located in Tomcat's conf/
directory. This web.xml file (which you will probably need
to create) will reside in your web-application's WEB-INF/
directory. For each servlet you want to call, provide a
pair of tags like the following:
...
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>your.package.name.HelloWorld</servlet-
class>
</servlet>
...
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
...
| Is This Answer Correct ? | 8 Yes | 2 No |
Post New Answer View All Answers
How can we perform any action at the time of deploying the project?
Explain the methods of request dispatcher in servlet?
What is servlet and its use?
What is cgi and what are its drawbacks?
What are the objects involved when a servlet receives a call from client?
What is difference between ServletResponse sendRedirect() and RequestDispatcher forward() method?
What is the difference between encodeRedirectUrl and encodeURL?
What is a deployment descriptor?
What is the difference between servlet and filter?
What are the differences between servlet context vs servlet config?
Differentiate between get and post?
What are the exceptions thrown by servlets? Why?
What are the disadvantages of storing session state in cookies?
What is servlet collaboration?
How to read request headers from servlets?