views:

39

answers:

1

I can't realize why do I have 404 error while trying to access /liginform.dlp through POST method

I have the following web.xml mapping:

  <servlet-name>doolloop</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>doolloop</servlet-name>
    <url-pattern>*.dlp</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>doolloop</servlet-name>
    <url-pattern>/index.dlp</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.dlp</welcome-file>
  </welcome-file-list>

doolloop-servlet.xml looks like this:

<context:component-scan base-package="com.doolloop.controllers" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>

I have two jsp pages /index.jsp /forms/loginform.jsp

The controllers looks lke this:

@Controller
public class DoolloopController{
    protected final Log logger = LogFactory.getLog(getClass());

    @RequestMapping("/index.dlp")
    public ModelAndView index(){
        logger.info("Return View");
        return new ModelAndView("index");
    }

The following code brings 404 error:

 @RequestMapping(value="/loginform.dlp",method = RequestMethod.GET)
        public ModelAndView CheckLogin(){
            ModelAndView mv = new ModelAndView("/form/loginform");
            return mv;
        }

If I change it to the following way it works perfectly:

@RequestMapping(value="/loginform.dlp",method = RequestMethod.GET)
        public String showForm() {
                return "/forms/loginform";

what is the problem? please help

+2  A: 

Perhaps your resolved JSP path starts with double slash (one from the prefix property and another from the returned value).

axtavt