• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

spring security messages 3.1

 
Luis Parente
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,


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
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you defining your MessageSource?

Typically you would set the base in that configuration and then have a file somewhere like

messages_en_US.properties (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

 
Luis Parente
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi thanks for your response.


it's work


The language is french
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic