Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6839619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:44:26+00:00 2026-05-26T23:44:26+00:00

I have integrated Spring Security in my application , and would like to display

  • 0

I have integrated Spring Security in my application , and would like to display an error message to the user in case of Bad credentials.

I have wired everything in to display the message , but it does not work. Please find the code snippets below

spring-security.xml

<form-login
            login-page="/spring/login"
            authentication-failure-url="/spring/login?error=true"               
            default-target-url="/spring/index"/>

<authentication-manager>
    <authentication-provider user-service-ref="customService">
    </authentication-provider>
</authentication-manager>

CustomService implements UserDetailsService , and in the loadUserByUsername method , i am returning the Spring UserDetails object which contains the details of the user.

My Controller looks as follows

@RequestMapping(value="/login", method = RequestMethod.POST)
    public String getLogin(@RequestParam(value="error", required=false) boolean error, 
            ModelMap model){

        if (error == true) {
            // Assign an error message
            model.put("error", "You have entered an invalid username or password!");
        } else {
            model.put("error", "");
        }


        return "loginpage";
    }

My loginpage contains the following div to paint the error

<div id="login-error">
        <c:if test="${not empty param.error}">
            Your login attempt was not successful, try again.<br />
        </c:if>
</div>

When I enter wrong credentials , it is redirected to the login page, but the message is not being displayed.

Please help and correct me if I am doing anything wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:44:26+00:00Added an answer on May 26, 2026 at 11:44 pm

    Issue Resolved.

    The real reason for the error message not being painted was that the ${not empty param.error} was not being evaluated.

    To fix this issue , modified my web.xml to conform to the Servlet 2.5 Spec. and it worked like a charm. 🙂

    Please refer my post on changing the Servlet Spec to v2.5

    Issue with evaluating ${error} in Spring

    Hope this helps all those who might face this issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have integrated spring security plugin with my grails application, which has hibernate as
I have integrated Spring Security in my application and have defined access levels to
We have a Spring MVC application. We now have to integrate spring security in
We have Spring MVC application. We are trying to integrate the Spring security in
I have a JSP struts application that uses Spring to integrate with the services/dao/database.
I have integrated a Silverlight Navigation Application in an ASP.NET MVC web. However when
I have always enabled integrated security on my web apps inside IIS with the
I have an ASP.Net 2.0 application that uses integrated Windows Authentication to authenticate/authorize users.
I have a grails app configured with spring-security-core and I need to allow Facebook
I'm developing a web application with multiple frameworks (spring, hibernate, spring-security, ZK for GUI),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.