Announcement Announcement Module
Collapse
No announcement yet.
404 error on REST when controller redirecting to jsp Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 404 error on REST when controller redirecting to jsp

    Hi,

    I am trying to redirect to a jsp page to display a result but I always get the following:

    HTTP Status 404 - /SpringREST/WEB-INF/jsp/cloth.jsp
    type Status report
    message /SpringREST/WEB-INF/jsp/cloth.jsp
    description The requested resource (/SpringREST/WEB-INF/jsp/cloth.jsp) is not available.

    Web.xml:
    Code:
             <servlet>
    		<servlet-name>restful</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/restful-servlet.xml</param-value>
            </init-param>
    	</servlet>
    	
    	<servlet-mapping>
    		<servlet-name>restful</servlet-name>
    		<url-pattern>/rest/*</url-pattern>
    	</servlet-mapping>
    Content of restful-servlet.xml:
    Code:
    <context:component-scan base-package="com.funcom.fwl.rest.controller" />
        
    <mvc:annotation-driven />
    
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
         <property name="prefix">
    	 <value>/WEB-INF/jsp/</value>
        </property>
        <property name="suffix">
             <value>.jsp</value>
        </property>
    </bean>
    The controller:
    Code:
    @Controller
    public final class RestfulController {
    @RequestMapping(value = "/cloth", method = RequestMethod.GET)
    	public ModelAndView getCloth(@RequestParam("item_id") long itemId, @RequestParam("locale") String locale) {
    		final ModelAndView mav = new ModelAndView("cloth");
    		mav.addObject("itemName", "testItem");
    		return mav;
    	}
    }
    I am not sure what I am doing wrong here. There are several examples that are similar and they all work fine.

    Thank you.
Working...
X