Configuring JSP File

Advertisements

JPS Translation Difference Between Servlet and JSP

Configuring JSP File

Configuring a JSP into a web.xml file is optional because JSP is a public file to the web application.

A JSP called a public file and servlet is called a private file of the web application. Because JSP files stored in root directory of the web application and Servlet class file stored in sub directory of the web application. Because JSP is the public file, we can directly send a request from a browser by using its file name.

If we want ot configure a JSP in web.xml file the the xml elements are same as Servlet-configuration. We need to replace <servlet-class> element with <jsp-file>

Syntax

<web-app>
<servlet>
<servlet-name>test</servlet-name>
<jsp-file>/One</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>test</>
<url-pattern>/srv1</url-pattern>
</servlet-mapping>
</web-app>

Note: If we configure a jsp in web.xml then we can send the request to the jsp either by using jsp filename or by using its url-pattern.

Example

httpp://localhost:2014/root/One.jsp
                        or
httpp://localhost:2014/root/srv1

JPS Translation Difference Between Servlet and JSP

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements