I use JSF2, RichFaces 4, Rich: Choose. Manually input is allowed and user can input some such that does not conform to any predefined item labels. In this situation, how to set value = null (if any items are selected)?
& lt; Rich: Select ID = "Select" value ChangeListener = "# {comboBox.valueChangedGo}" Enable ManualInput = "true" required = "incorrect" & gt; & Lt; F: selection item item item = "0" item label = "Russia" /> & Lt; F: selection item item item = "1" item label = "Ukraine" /> & lt; F: select item item value = "2" itemLabel = "Norway" /> & Lt; F: selection item item item = "3" item label = "Sweden" /> & Lt; F: select item item value = "4" itemLabel = "Finland" /> & Lt; F: selection item item item = "4" item label = "Belarus" /> & Lt; F: Ajax render = "count2" /> & Lt; / Rich: Selections & gt; Use this as a custom: Package com.whatever.conveters; Import javax.faces.component.UIComponent; Import javax.faces.context.FacesContext; Import javax.faces.convert.converter; // If you are using spring ... import org.springframework.beans.factory.annotation.autoired; Import org.springframework.context.annotation.Scope; Import org.springframework.stereotype.Component; // Again, if you are using spring ... @component ("testconverter") @ scope ("request") applies public class testconverter converter {// injection or solving this archive by any other method Private map to & lt; Country & gt; Countries; @OverWide Public Objects GetAsObject (FacesContext Face Contact, UIComponent uiComponent, String value) // Check that "value" is in the collection of items / / // here I am using a map, but you can inject one service // If an inquiry is done by one of the value service methods (if countries are consulted (value)) {return value; } And {return tap; }} @ Override public string get eststrings (face syntax face contact, UIcomment UI Component, object value) {// here, just return to the toasting of YouTube Return Value. To string (); }} It should help
Comments
Post a Comment