i want to know what should i put inside Servletname tag and url path in servlet-mapping in web.xml in eclipse.i tried googling it but i didnt find answer. Please suggest me in this, i am creating rest services in Java.
<servlet>
<servlet-name>FirstWebserviceApplication</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.restservice.jersey</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FirstWebserviceApplication</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Element : servlet-name The servlet-name element contains the canonical name of the servlet. Each servlet name is unique within the web application. Used in: filter-mapping, servlet, servlet-mapping
Element : url-pattern
The url-pattern element contains the url pattern of the mapping. This is how you want your servlet class to be accessed. if you put /hello then your servlet will invoke when user access http://yourdomain/yourappname/hello
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With