Localizing field labels in struts 2

A short tip about localizing field labels in your jsp page in struts 2. First off, the message should be present in the message resource bundle. Now how do you read it into the field label?

Here's how:

<s:password label="%{getText('password')}" name="password" />

How does this work?

The framework takes care of this.
In the text filed, the expression %{getText('password')} tells the framework to lookup "password" in the message resources.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

manveen

Search

Archives
« August 2015
SunMonTueWedThuFriSat
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
     
Today