[
https://issues.jboss.org/browse/SEAMFACES-186?page=com.atlassian.jira.plu...
]
Jack Cheng commented on SEAMFACES-186:
--------------------------------------
I added one method to call the findComponent method of the descendent NamingContainers to
find the component matching the id.
the method finds the nested components, but the getSubmittedValue() method of the nested
components returns null. I don't think this has to do with Seam Faces but an issue
with the underlying JSF implementation. the workaround is for s:validateForm to be in the
same NamingContainer as the nested components.
{panel}
<h:form id="f">
<h:dataTable id="t" value="1" var="x">
<h:column id="c">
<h:inputSecret id="password"/>
<h:message for="password" />
<h:inputSecret id="passwordRepeat"/>
<h:message for="passwordRepeat"/>
<s:validateForm validatorId="passwordInputElementValidator"/>
</h:column>
</h:dataTable>
<h:commandButton value="Submit"/>
</h:form>
{panel}
<s:validateForm>: injection of nested component values fails
------------------------------------------------------------
Key: SEAMFACES-186
URL:
https://issues.jboss.org/browse/SEAMFACES-186
Project: Seam Faces
Issue Type: Bug
Components: Validation & Conversion
Affects Versions: 3.0.2
Environment: JBAS 7
Mojarra 2.0.4
Reporter: Matija Mazi
Priority: Minor
This valitator:
{code:java}
@FacesValidator("passwordRepeatValidator")
@RequestScoped
@Named
public class PasswordRepeatValidator implements Validator {
@Inject @InputField private String password;
@Inject @InputField private String passwordRepeat;
@Override
public void validate(FacesContext facesContext, UIComponent uiComponent, Object o)
throws ValidatorException {
if (!passwordRepeat.equals(password)) {
throw new ValidatorException(new FacesMessage("Passwords don't
match."));
}
}
}
{code}
used like this:
{code:xhtml}
<h:form id="f">
<s:validateForm validatorId="passwordRepeatValidator"/>
<h:dataTable id="t" value="1" var="x">
<h:column id="c">
<h:inputSecret id="password"/>
<h:message for="password"/>
<h:inputSecret id="passwordRepeat"/>
<h:message for="passwordRepeat"/>
</h:column>
</h:dataTable>
<h:commandButton value="Submit"/>
</h:form>
{code}
fails with:
{code}
10:57:13,407 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[ppay-web].[/].[Faces Servlet]]
(http--127.0.0.1-8080-2) Servlet.service() for servlet Faces Servlet threw exception:
java.lang.IllegalArgumentException: org.jboss.seam.component.UIValidateForm-- Could not
locate component [f:password]
at
org.jboss.seam.faces.component.FormValidationFieldProducer.findComponent(FormValidationFieldProducer.java:160)
[seam-faces-impl-3.0.2.Final.jar:]
at
org.jboss.seam.faces.component.FormValidationFieldProducer.getInputFieldValue(FormValidationFieldProducer.java:76)
[seam-faces-impl-3.0.2.Final.jar:]
at sun.reflect.GeneratedMethodAccessor446.invoke(Unknown Source) [:1.6.0_24]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at
org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at
org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:169)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.bean.ProducerMethod$1.produce(ProducerMethod.java:149)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:361)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:67)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:693)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:775)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:138)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:875)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:887)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:182)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:54)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:176)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:142)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:170)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:339)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:122)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at
org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:87)
[weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
at
com.example.PasswordRepeatValidator$Proxy$_$$_WeldClientProxy.validate(PasswordRepeatValidator$Proxy$_$$_WeldClientProxy.java)
[backend-1.0.0-SNAPSHOT.jar:]
at org.jboss.seam.faces.component.UIValidateForm.validate(UIValidateForm.java:96)
[seam-faces-api-3.0.2.Final.jar:]
at javax.faces.component.UIInput.executeValidate(UIInput.java:1209)
[jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.faces.component.UIInput.processValidators(UIInput.java:698)
[jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.faces.component.UIForm.processValidators(UIForm.java:244)
[jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1085)
[jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1165)
[jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
[jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
[jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
[jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
[jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.0.CR4.jar:7.0.0.Final]
{code}
If the <h:dataTable><h:column> code is removed, it works as expected. It
seems FormValidationFieldProducer is not able to locate the input components (password,
passwordRepeat) if they are nested inside a NamingContainer (it this case a data table).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira