0

I'm working on a website using both WaveMaker and Springsource MVC.

The entry generated by WaveMaker is named 'index.html'. I import all browser-side code into the /view directroy of an MVC project. And try to configure ContextLoadListener to map it into an uri. Using:

@RequestMapping(value = "/index", method = RequestMethod.GET)
public String testIndex() {

    return "index.html";
}

Then I got the following error testing it:

SEVERE: PWC6117: File "C:\glassfish3\glassfish\domains\domain1\eclipseApps\TribblesDashboard\WEB-INF\views\index.html.jsp" not found

How do I fix it?

3
  • 1
    See static.springsource.org/spring/docs/3.1.x/…. But the easiest solution is to rename the index.html file to index.jsp. Commented Oct 31, 2012 at 19:10
  • 2
    Looks like your viewResolver isn't configured correctly. Do you have one defined? Commented Oct 31, 2012 at 19:10
  • The default viewResolver behaviour is to automatically looks for the returned view name with ".jsp" on the end. So rename "index.html" to "index.jsp" and then return just "index" Commented Nov 1, 2012 at 0:25

1 Answer 1

2

This can be due to two reasons.

  1. The declaration of view resolver in application context. This should be some thing like this:
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix">
        <value>/WEB-INF/jsp/</value>
    </property>
    <property name="suffix">
        <value>.jsp</value>
    </property>
</bean>

This indicates that the views should be placed in the WEB-INF/jsp folders.

  1. The second is to check the Dispatcher Servlet configuration in the web.xml.
<servlet-mapping>
    <servlet-name>DispatcherServlet</servlet-name>
    <url-pattern>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>DispatcherServlet</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>

Check if the mappings are OK.

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you so much! These are exactly what I need. On the seccond part. My servlet-mapping pattern was set to: <url-pattern>/</url-pattern>
Can you please mark the answer as the correct one so that the others who face the same problem will be benefited. Thanks!
Whoops: there is still a problem, but now the error information has become: INFO: WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/tribblesdashboard/WEB-INF/views/index.html] in DispatcherServlet with name 'appServlet' And as before, returns a 404 error. Seems like I missed something
Interesting, I have manually added the required mapping: @RequestMapping(value = "/tribblesdashboard/WEB-INF/views/home.html", method = RequestMethod.GET) public String ddefault(Locale locale) { return "/tribblesdashboard/WEB-INF/views/home.html"; } But still got the same result
If the above solution does not work then look for the location of the html is it really present in WEB-INF/jsp folder or the WEB-INF/views folder. Change the mapping of the InternalResourceViewResolver in the application context. <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix"> <value>--Change this ---/WEB-INF/jsp/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.