• Post Reply Bookmark Topic Watch Topic
  • New Topic

<f: attribute > value from a resource bundle  RSS feed

 
Rajesh Unnithan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a jsf application deployed in my jboss5.0.0GA server.

In my jsf page I have the following

<f:validator validatorId="regExpValidator"/>
<f:attribute name="regularExpr" value="[0-9a-zA-Z \t]*"/>
<f:attribute name="regExErrMssg" value="#{bundle.ACCOUNT_NAME_FORMAT_ERROR_MESSAGE}"/>

If the validation fails I will display the error message from the regExErrMssg in my validator class.
When I am trying to get the value for regExErrMssg in my validator class using component.getAttributes().get("regExErrMssg");

I am getting it as null. where as when I am trying to get the same for regularExpr I am getting the value.

Only difference between these 2 are in regularExpr I am giving the value directly where as in regExErrMssg I am trying to get the message from a resource bundle.

What could be the issue ? Any info would be really helpful.

Thanks in advance.

Regards
Hari
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The bundle is only "evaluatable" during render response.
Change your validator so that it obtains the message from the bundly directly. You can use java.util.ResourceBundle API for this. In the f:attribute you can if necessary just pass the bundle key as string.
 
Rajesh Unnithan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Scholtz

Thanks for the replay.

I tried to retrieve the value using the resource bundle API & it worked.

Appreciate your help

Regards
Harikrishnan
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!