[jboss-user] [JBoss Seam] - After updating to 2.0.0.GA uiComponent.findComponent(string)
jbuechel
do-not-reply at jboss.com
Tue Nov 6 11:31:58 EST 2007
When i deploy the application with the new Seam 2.0.0.GA jar files the method
UIComponent comparedUIComponent = uiComponent.findComponent(comparedFieldId);
returns null. When i deploy it with 2.0.0.BETA1 the component is found..
I don't have any idea why this behavior occurs as it's not seam code..!?
@Name("equalsFieldValidator")
| @BypassInterceptors
| @Validator(id = "com.frox.fwc.validator.equalsFieldValidator")
| public class EqualsFieldValidator implements javax.faces.validator.Validator {
|
| public final static String ATTRIBUTE_COMPARED_COMPONENT_ID = "comparedFieldId";
|
| /*
| * (non-Javadoc)
| *
| * @see javax.faces.validator.Validator#validate(javax.faces.context.FacesContext,
| * javax.faces.component.UIComponent, java.lang.Object)
| */
| @Override
| public void validate(FacesContext facesContext, UIComponent uiComponent, Object value)
| throws ValidatorException {
|
| String fieldValue = (String) value;
| UIComponent equalInputField = this.getComparedComponent(uiComponent);
|
| Object equalValue = ((UIInput) equalInputField).getValue();
|
| if (!fieldValue.equals(equalValue))
| throw new ValidatorException(FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR,
| "com.frox.fwc.validator.equalsField", ""));
| }
|
| public UIComponent getComparedComponent(UIComponent uiComponent) {
|
| String comparedFieldId = (String) uiComponent.getAttributes().get(
| ATTRIBUTE_COMPARED_COMPONENT_ID);
| if (comparedFieldId == null)
| throw new IllegalStateException(
| "Attribut equalComponentId must be set. ");
|
| UIComponent comparedUIComponent = uiComponent.findComponent(comparedFieldId);
| if (comparedUIComponent == null)
| throw new IllegalStateException("UIComponent with id " + comparedFieldId
| + " not found.");
|
| return comparedUIComponent;
| }
| }
|
<f:validator validatorId="com.frox.fwc.validator.equalsFieldValidator" />
| <f:attribute name="comparedFieldId" value="user_label_new_password" />
| <s:validate />
Any help would be great!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102268#4102268
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102268
More information about the jboss-user
mailing list