• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using convertor in jsf

 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a h:inputText in my JSP. I have associated the value of this component with a backing bean property of type Double.

If input contains letters then I need to call a method in the backing bean and set the appropriate rendering flag and display the message.

But the action method is not called if a letter is entered, I guess this is because of the life cycle where conversion - validation - action takes place.

Hence it fails in the conversion phase. How can I call a backing bean method during conversion phase?

Regards,
Joshua
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you're missing the point. It sounds like you're simply trying to do what the validator does anyway.

What you probably should be doing is simply using the standard validator, or customize it if it doesn't do what you want.
 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

I tried to use a validator like:


But the problem I faced was that:

1. Validate method was getting called only if numeric value is enterd in the text field(corr backing bean property is of type Double)

2. Validate method not getting called if any string is entered

I need the validate method to be called irrespective of what is entered, so that I can do validation in that method and display appropriate message using FacesMessage.

Hopefully I am bit clear now.

Regards,
Joshua
 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess, I need to use custom convertor, any other suggestion is welcome.

Regards,
Joshua
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic