Jsp Mapping in web.xml

JSP URL MAPPING FOR AJAX REQUESTS

First of all we need to understand that the web.xml file provides configuration and deployment information for the Web components that comprise a Web application.

Under Netbeans Web.xml is present in  WEB-INF

As we know the Jsp files are ultimately converted into servlet .so we can also map our Jsp.

Mapping specifies the web container of which java servlet/jsp file  should be invoked for a url given by client. 

For Example if clieant needs to acess register.jsp then the url for that file can be mapped as

<servlet>
          <servlet-name>signup.jsp</servlet-name>
          <jsp-file>/register.jsp</jsp-file>
    </servlet>
    <servlet-mapping>
          <servlet-name>signup.jsp</servlet-name>
          <url-pattern>/signup.xml</url-pattern>
    </servlet-mapping>

Now in order to acess register.jsp client has to use the url as signup.xml .. Then the file register.jsp will be executed . Which hides actual identity of the resource .

Thank you

 

 

2 comments:

  1. another way is to use the compiled servlet corresponding to the JSP file as explained at Mapping url's to jsp

    ReplyDelete
    Replies
    1. Thanx Sandeep for your valuable post.. but the thing is that Jsp's are ultimately compileded to servlet. And most of the time we are concentrated on ,mapping servlet . Jsp Life Cycle

      Delete

Setting Spring MVC in Eclipse -Dynamic Project

Steps in Setting Up Spring MVC  The process of setting up the Spring MVC project using Eclipse is a crucial ability for anyone Java dev...

Powered by Blogger.