Announcement Announcement Module
No announcement yet.
how to map request url to jsp Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to map request url to jsp

    Hi All,

    I am new to Spring framework. I want to write the same functionality of below code in spring framework. This code written in web.xml file of web application.



    Can somebody please help me.

  • #2
    Building a web app

    First of all, I understand you are new to Spring framework, but this is not the way to design a web application on the basis of a web.xml.

    You need to have a set of requirements i.e. some Jsp's and their flows and how do you want to build the web application.
    By the way if you want to start on a Web application using spring framework, then refer to the Spring reference documentation.You need to have information with you regarding a your dispatcherservlet,controllers,viewresolver and bean definitons file.


    • #3
      And as far as the topic of the post is concerned, you can map servlet url pattern to jsp using org.springframework.web.servlet.view.InternalResou rceViewResolver class
      and by adding the following property in the bean used for ViewResolver
      <property name="viewClass">
      <value>org.springframework.web.servlet.view.JstlVi ew
      <property name="prefix">
      <property name="suffix">

      So now if you request for hello.html , the viewResolver will check for hello.jsp in WEB-INF/jsp folder and if the file exists ,it will map the url and will show you the desired page


      • #4
        sorry for picking up this old topic. This thread is coming in search results and wanted to add what I had been searching for:
        We can also map a JSP file to request URL by using the translated and compiled .class file corresponding to that JSP. This .class file is placed in the work folder of server by JSP engine. The sample mapping shall look like:


        More details: Map Servlet/JSP to URL