Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to invoke a Servlet?

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


Please Help Members By Posting Answers For Below Questions

What methods do you use in servlet - applet communication?

1005


How can the referrer and the target urls be used in servlet?

963


How to make sure a servlet is loaded at the application startup?

1009


What is the difference between encodeRedirectUrl and encodeURL?

1078


If a servlet is not properly initialized, what exception may be thrown?

1144


Which HTTP method is non-idempotent?

1081


Explain how does JSP handle run-time exceptions?

1054


What is the purpose of inter-servlet communication?

1058


Tell us something about servletcontext interface.

1051


How a servlet is unloaded?

1043


Explain the methods of request dispatcher in servlet?

1001


Explain get and post.

1071


How is the get () method different from the post() method?

930


What is the major difference between context parameter and context attribute?

1066


Which interface should be implemented by all servlets?

1180