Announcement Announcement Module
Collapse
No announcement yet.
no controller called while accessing the welcome-file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • no controller called while accessing the welcome-file

    I have got a "start" file defined in my web.xml:

    Code:
    <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>

    My "mapping":
    Code:
    <bean name="/index.html" class="at.newsagg.web.IndexViewController"/>
    The problem is that no associated controller is called and the included taglibs are not working. I already tried to set the welcome page to index.html but then I get a message that the resource is not available.

    fmt:message says that it does not find the key value
    spring:bind is not working with the message:
    javax.servlet.jsp.JspTagException: Neither Errors instance nor plain target object for bean name 'login' available as request attribute

  • #2
    I already tried to set the welcome page to index.html but then I get a message that the resource is not available.
    That's exactly what you should be doing.
    Please take a look at Developing a Spring Framework MVC application step-by-step. It may answer your questions.
    HTH

    Comment


    • #3
      Re: no controller called while accessing the welcome-file

      Originally posted by elLord
      I have got a "start" file defined in my web.xml:

      Code:
      <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
          </welcome-file-list>

      My "mapping":
      Code:
      <bean name="/index.html" class="at.newsagg.web.IndexViewController"/>
      The spec only allows you to set a welcome page in web.xml that maps to a physical resource, such as an HTML file or JSP that is directly accessible. That's why it fails when you try to use index.html as your start page.

      In index.jsp (which needs to exist outside of WEB-INF to make it accessible) you can't put any Spring type stuff because the container serves the page directly and it doesn't go through the dispatcher servlet. Typically your index.jsp simply contains a redirect to "/yourapp/index.html" which will then go via the dispatcher and use your bean mapping.

      Regards,

      Comment


      • #4
        Welcome file for tomcat

        Here is what I do for Tomcat:

        Set index.html as a welcome file.
        Create an empty index.html.
        Map spring servlet to handle *.html.
        Then create a mapping in spring for /index.html

        Tomcat sees that index.html exists. However, it uses servlet mapping to decide which servlet should render index.html and it will be spring

        Comment

        Working...
        X