title: Returning a login error message using Shiro
body: <p>Filters and redirects are not my strong point.</p>
  
  <p>I have Shiro set up and working in Spring except that I'd like to return an error message on an invalid login while staying of the same page. So I'm causing a invalid login. I've got ShiroFilterFactoryBean set with a property that should send it to /ldapLoginErr which then I map to login.jsp and then process in a error function in my Controller. But I'm getting a 404 and the url is pointing to my base url instead /ldapLoginErr or /ldapLogin.</p>
  
  <pre><code>   class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
  &lt;/bean&gt;
  
  &lt;mvc:view-controller path="/ldapLogin" view-name="ldapLogin" /&gt; 
  &lt;mvc:view-controller path="/ldapLoginSuccess" view-name="ldapLogin" /&gt; 
  &lt;mvc:view-controller path="/ldapLoginErr" view-name="ldapLogin" /&gt; 
  
  
            &lt;bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"&gt;
      &lt;property name="securityManager" ref="securityManager"/&gt;
      &lt;property name="loginUrl" value="/ldapLogin"/&gt;
      &lt;property name="unauthorizedUrl" value="/ldapLogin"/&gt;
      &lt;property name="successUrl" value="/ldapLogin"/&gt;
      &lt;property name="filterChainDefinitions"&gt;
          &lt;value&gt;
              [urls]
              /** = ssl[8443],authc, customAuthFilter
              [main]
              /logout = logout
          &lt;/value&gt;
      &lt;/property&gt;   
  &lt;/bean&gt;
  
  
        @RequestMapping(value = "/ldapLogin", method = RequestMethod.GET)
  public ModelAndView login(Model model, HttpSession session){
      logger.debug("start login controller function");
  
      ModelAndView mav = new ModelAndView();
      return mav;  
  }
  
  @RequestMapping(value = "/ldapLoginErr", method = RequestMethod.GET)
  public ModelAndView loginErr(Model model, HttpSession session){
          ModelAndView mav = new ModelAndView();
      mav.addObject("errorMessage", msgSrc.getMessage("auth.notauth", null, null, null));
  
      return mav;  
  }
  
  @RequestMapping(value = "/ldapLoginSuccess", method = RequestMethod.GET)
  public ModelAndView loginSuccess(Model model, HttpSession session){
  
    }
  
  
    The following didn't work either:
  
        &lt;bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"&gt;
      &lt;property name="securityManager" ref="securityManager"/&gt;
      &lt;property name="loginUrl" value="/ldapLogin"/&gt;
      &lt;property name="unauthorizedUrl" value="/ldapLoginErr"/&gt;
      &lt;property name="successUrl" value="/ldapLoginSuccess"/&gt;
  </code></pre>
  
  <p>Thanks for any help</p>