www.webdeveloper.com
Results 1 to 5 of 5

Thread: Extension less URL + jsp

  1. #1
    Join Date
    Jun 2009
    Posts
    24

    Extension less URL + jsp

    Hi, I have developed application in jsp and apache tomcat. How to achieve extension less url? For eg, if have http://www.xxx.com/yyy.jsp as http://www.xxx.com/ and http://www.xxx.com/user/yyy.jsp as http://www.xxx.com/user/

  2. #2
    Join Date
    Jan 2009
    Posts
    3,346

  3. #3
    Join Date
    Jun 2009
    Posts
    98
    Use servlet-mapping in your web.xml.

    Servlet example:
    PHP Code:
    <servlet>   
    <
    servlet-name>YourServlet</servlet-name>   
    <
    servlet-class>YourServletClass</servlet-class> 
    </
    servlet

    <
    servlet-mapping>   
    <
    servlet-name>YourServlet</servlet-name>   
    <
    url-pattern>/extensionLessUrl</url-pattern
    </
    servlet-mapping
    JSP example:
    PHP Code:
    <servlet>
    <
    servlet-name>second</servlet-name>
    <
    jsp-file>/src/jsp/Welcome.jsp</jsp-file>
    </
    servlet>

    <
    servlet-mapping>
    <
    servlet-name>second</servlet-name>
    <
    url-pattern>/extensionLessUrl</url-pattern>
    </
    servlet-mapping

  4. #4
    Join Date
    Jun 2009
    Posts
    24
    Hi JavaServlet,

    Its not working. Could you please brief me more? i need exactly like this "http://www.xxx.com/user/yyy.jsp as http://www.xxx.com/user/"

  5. #5
    Join Date
    Jun 2009
    Posts
    98
    Try this:
    PHP Code:
    <servlet
    <
    servlet-name>servletName</servlet-name
    <
    jsp-file>/yyy.jsp</jsp-file
    </
    servlet

    <
    servlet-mapping
    <
    servlet-name>servletName</servlet-name
    <
    url-pattern>/</url-pattern
    </
    servlet-mapping
    Depending on your Tomcat configuration you might have to restart the container.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles