Announcement Announcement Module
No announcement yet.
Error message not being displayed Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error message not being displayed

    I am using the spring social example and modified it to use mysql database for authentication.
    If the login is incorrect it goes to

    and the signing.jsp has the following

      		<c:if test="${param.error eq 'bad_credentials'}">
      		<div class="error">
      			Your sign in information was incorrect.
      			Please try again or <a href="<c:url value="/signup" />">sign up</a>.
      		<c:if test="${param.error eq 'multiple_users'}">
      		<div class="error">
      			Multiple local accounts are connected to the provider account.
      			Try again with a different provider or with your username and password.
    but it doesn't show the message.

     Security.xml has the following
    	<http use-expressions="true" auto-config='true' access-denied-page="/signin">
    		<!-- Authentication policy -->
    		<form-login login-page="/signin" 
    			authentication-failure-url="/signin?param.error=bad_credentials" />

    SigninController was originally returning void, but if the user is logged in I wanted to go back to home.
    	@RequestMapping(value="/signin", method=RequestMethod.GET)
    	public String signin(Principal currentUser, Model model) {
    		logger.debug("Signin controller");
    		if (null != currentUser){
    			return "redirect:/";
    		return null; 
    How do I get the error to show?

  • #2
    Have you tried changing your Spring Security configuration to use the parameter error rather than param.error? Using param. in JSTL is just a way of accessing HTTP parameters, it is not the prefix for the query parameter. The JSTL expression in your signing.jsp is testing to see if an HTTP parameter named error is equal to something and the redirect is specifying a query parameter by the name of param.error (they don't match). If you are having further problems I suggest you try running through the Spring Security samples which demonstrate how to do this and potentially reading up on JSTL.