You're right. It also works with JSF 1.2. Validators, however, aren't called.
2008/10/2 bobhedlund <[EMAIL PROTECTED]> > This does work - I use it with JSF 1.1. Converters are always called. > > ------------------------------ > *From:* Jan-Kees van Andel [mailto:[EMAIL PROTECTED] > *Sent:* Wednesday, October 01, 2008 2:02 PM > > *To:* MyFaces Discussion > *Subject:* Re: What for a damm validation conncept > > @bobhedlund: This probably won't work since Converters and Validators > aren't called for null values. UIInput handles this case different. > > But if you are using JSF 1.2, you can add required messages on a > per-component basis. > > http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/component/UIInput.html#setRequiredMessage(java.lang.String)<http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/component/UIInput.html#setRequiredMessage%28java.lang.String%29> > > You can do the same thing with a JSP/Facelet tag. > > @jhomuth: Next time mind your language, you 'might' get more/better > response. > > Good luck, > > Jan-Kees > > > > 2008/10/1 bobhedlund <[EMAIL PROTECTED]> > >> You can provide a custom converter that handles this in much the same way >> as >> a validator. You can customize the message using the attribute >> "requiredMessageDetail" by pulling it off the component reference in the >> Converter. This would also allow you to specify default messages in >> addition >> to field specific messages. In your getAsObject method just check if the >> field is empty, throw a converterException otherwise, and put the messages >> in some context. >> >> >> Regards >> Bob >> >> >> -----Original Message----- >> From: Stephen Friedrich [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, September 30, 2008 3:12 PM >> To: MyFaces Discussion >> Subject: Re: What for a damm validation conncept >> >> Yup, JSF validation is really lacking. >> >> I don't think you have a chance to get that desired behavior with JSF >> validation. >> The most pragmatic solution is probably to "manually" do the validation in >> your action handler, instead of using JSF's validation concept. >> >> (Yes, I just hate that, even more so because I use Seam to enable entity >> beans as backing beans for my forms. However now I can't do that any >> longer >> and have to use artificial value objects instead - no validation => >> invalid >> values get written to the entities, because those entities are still >> managed, they would be written to the DB on next flush. What a mess.) >> >> jhomuth wrote: >> > Hi List, >> > >> > I've tried a lot to validate my selectManyListBox. This validation >> > would be very simple, because I only want to validate if the user >> > selected something in that listbox. But as I know now, that a custom >> > validator will not called if the field, which you want to validate is >> empty. WTF. >> > Someone would say, why not use the "required" Attribute of that >> > UIComponent. But that's f******g bad, because there only will a >> > standard message displayed and that not what I want to do. Ok I can >> > customize the Message but only to a standard required message which >> > could not be customized for different fields. Is there any workaround, >> > that my custom validator will be called if the damm required attribute >> > is not set and the field to validate has no input. >> > >> > Please help me before I get real crazy. >> > >> > Thx for suggestions >> >> >

