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

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()?

1092


What are the drawbacks of cgi?

1036


What is the difference between get and post methods?

1040


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

1040


What are the different ways we can maintain state between requests?

1095


Whats the advantages using servlets over using CGI?

1072


What are the different methods involved in generic servlet?

1091


Define the lifecycle for executing a jsp page.

1081


What is a server side include (ssi)

1152


What is difference between the HTTP Servlet and Generic Servlet? Explain about their methods and parameters?

1061


What is the capacity the doget can send to the server?

1076


What do you mean by singlethreadmodel interface?

1044


How we can get ip address of client in servlet?

989


What do you mean by the servlet chaining?

1077


What is difference between jsp and servlet?

1172