Autowiring attributes to custom Validator

View: New views
1 Messages — Rating Filter:   Alert me  

Autowiring attributes to custom Validator

by Luca Graf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi together,

i have implemented an custom validator and try now to get it working
with facelets. It works but the autowiring of attributes doesn't work
for me, i get null values in my converter.


I have created an facelets taglib:

<facelet-taglib>
    <namespace>http://mycompany.com/jsf/tags</namespace>
    <tag>
        <tag-name>propertyTemplateValidator</tag-name>
        <validator>
            <validator-id>UniquePropertyTemplateValidator</validator-id>
        </validator>
    </tag>
</facelet-taglib>


The validator is declared in the faces-config.xml:

<validator>
         <validator-id>UniquePropertyTemplateValidator</validator-id>
         
<validator-class>jsf.validator.UniquePropertyTemplateValidator</validator-class>
         <property>
             <property-name>usedByID</property-name>
             <property-class>java.lang.String</property-class>
         </property>
         <property>
             <property-name>valueTypeID</property-name>
             <property-class>java.lang.String</property-class>
         </property>
</validator>


Example usage of the validator in an facelet template file:

<h:inputHidden id="usedBy"
value="#{ownerBean.currentResultItem.objectType}"
converter="ObjectTypeConverter"/>

<h:inputText id="propertyName" required="true"
value="#{ownerBean.newPropertyTemplateLable}">
         <inx:propertyTemplateValidator usedByID="usedBy"
valueTypeID="valueType"/>
</h:inputText>
               
<h:selectOneMenu id="valueType" value="#{ownerBean.newValueType}"
converter="PropertyValueTypeConverter">
        <f:selectItems value="#{actionBean.propertyValueTypeItems}"/>
</h:selectOneMenu>


The Converter has the fields usedByID and valueTypeID and getters and
setters for the fields.

private String usedByID;
private String valueTypeID;

public String getUsedByID() { return usedByID; }
public void setUsedByID(String usedByID) { this.usedByID = usedByID; }
public String getValueTypeID() { return valueTypeID; }
public void setValueTypeID(String valueTypeID) { this.valueTypeID =
valueTypeID; }



Iam missing something? Or i need to make use of Custom ValidateHandlers
to get the attributes to my validator?
Iam really new to jsf and facelets and help would be really nice.

Grettings,
Luca

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...