This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Spring and the fly likes  spring security messages 3.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark " spring security messages 3.1" Watch " spring security messages 3.1" New topic

spring security messages 3.1

Luis Parente
Ranch Hand

Joined: Jan 17, 2012
Posts: 39

In my code, I have the following lines: (my local is fr)

But the message in my page is the message by default:

L'identification a échoué, veuillez vous identifier à nouveau. Raison : Le nom dutilisateur {0} na pas été trouvé .

And the parameter {0} isn't replaced by username....

I need a little help please.

Thanks in advance.

Bill Gorder

Joined: Mar 07, 2010
Posts: 1646

How are you defining your MessageSource?

Typically you would set the base in that configuration and then have a file somewhere like (I chose US just because I have no idea what language that is )

which would in turn contain

DigestAuthenticationFilter.usernameNotFound=Utilisateur {0} non paramétré en base

Now when you access it you would do so like this:

Now that last String argument you provided is a default message which will be used if the lookup fails. In this case that String will be printed as is (no replacement is done) which is the behavior you are seeing.

for example

[How To Ask Questions][Read before you PM me]
Luis Parente
Ranch Hand

Joined: Jan 17, 2012
Posts: 39
Hi thanks for your response.

it's work

The language is french
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17249

Luis Parente wrote:Hi thanks for your response.

it's work

The language is french

Or in French, I think

C'est travaillez.

Or close to that. I think?


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: spring security messages 3.1
Similar Threads
Synchronization problem!!!
how to net Send from my java code although receiver has disable it
Implementing scanner into a simple login page
MultipleBagFetchException: cannot simultaneously fetch multiple bags. How to load 2 lists?
how to send message from Command prompt to the user in network and who ignore me