views:

128

answers:

2

Hi,

I want to display custom message which will be fetched from database when user try to login on login page. This message can be changed by administrator. So always need to be fetched from database.

We are using acegi spring.

Do anybody know how to do this?

Jaydeep.

A: 

set your login page to be served from a controller, then you can set a modelattribute with your custom message and show it on the login screen

e.g.

 @ModelAttribute("customMessage")
 public String populateCustomeMessage() {
      String msg // Code to get message from db and set it into a string
      return msg;
 }

 @RequestMapping(value = "/login.html", method = RequestMethod.GET)
 public String handleRequest() {
      return "login";
 }
Doug
A: 

Following link somewhat discusses on the topic you need (but not fetching from database)

http://stackoverflow.com/questions/1373407/how-to-display-custom-error-message-in-jsp-for-spring-security-auth-exception

novice