aspose file tools*
The moose likes JSF and the fly likes using convertor in jsf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "using convertor in jsf" Watch "using convertor in jsf" New topic
Author

using convertor in jsf

Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
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


SCJP,SCWCD, Into ATG now!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
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

Joined: Jun 05, 2006
Posts: 254
I guess, I need to use custom convertor, any other suggestion is welcome.

Regards,
Joshua
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using convertor in jsf