virtual form and validator (bug or feature)

I got 2 virtual forms

First, VF is associated with a drop down.

Second, VF is associated with text field and a button.

The text field has a validator

Upon selecting a value from dropdown (VF1 get submitted) the text field will get populated.

Here is where it get strange, the validator get called and when first form get submitted (dorpdown change) and the validator will not get called if the second VF get submitted.

How can I reverse the order? Have the validator evoked when the right virtual form is submitted?

[559 byte] By [maan_alfudhail] at [2007-11-26 8:46:32]
# 1

I tried to duplicate your problem but it seems impossible.

Message Group Component.

DropDown List in Virtual Form 1: Participates and Submits. Auto-Submit is on.

Text Field in Virtual Form 2: Participates

Button in Virtual Form 2: Submits

Prerender Code:

public void prerender() {

if (dropDown1.getSelected()!= null) {

textField1.setText(dropDown1.getSelected());

}

}

Text Field Validate Code:

public void textField1_validate(FacesContext context, UIComponent component, Object value) {

error("validator called");

}

I see that the is not getting updated when I choose a new value from the drop down list., because it does not participate in the form submit for the drop down list (VF1). Also, the I see that the validator method is not getting called (makes sense).

Then, I make the text field participate in both VF1 and VF2 and, because of the call to error() from the validation method, I see that the validator is indeed being called when I click the button to submit VF2 as well as when I choose it from the drop down list.

I cannot reproduce your problem. Can you help?

jetsons at 2007-7-6 22:32:09 > top of Java-index,Development Tools,Java Tools...
# 2

Ok it's a bug in the way SJSC update 1 handle validator

I have removed all the Virtual Forms, commented out all the validator procedures and made sure that in the properties there are no validator for the drop down. I also added in the prerender()

info("VALS: ");

Validator val[] = dropDown1.getValidators();

for (int i = 0; i < val.length; i++) {

info(val[i].toString());

}

When I ran it I got nothing.

I then created an

public void TEMP_validate(

FacesContext context, UIComponent component, Object value) {

}

and placed the procedure in the drop down validate property. To my surprise I found that the system is trying to find the old validator that I commented out when I change the value for the drop down.

Exception Handler

Description: An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error.

Exception Details: javax.faces.el.MethodNotFoundException

systemAdmin_category_nameEdit_textField_validate: community_loan.systemAdmin.SystemAdminCategory.systemAdmin_category_nameEdit_te xtField_validate(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)

Possible Source of Error:

Class Name: com.sun.faces.el.MethodBindingImpl

File Name: MethodBindingImpl.java

Method Name: method

Line Number: 206

Source not available. Information regarding the location of the exception can be identified using the exception stack trace below.

Stack Trace:

com.sun.faces.el.MethodBindingImpl.method(MethodBindingImpl.java:206)

com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:124)

javax.faces.component.UIInput.validateValue(UIInput.java:797)

javax.faces.component.UIInput.validate(UIInput.java:645)

javax.faces.component.UIInput.executeValidate(UIInput.java:849)

javax.faces.component.UIInput.processValidators(UIInput.java:412)

javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:91 2)

javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:91 2)

javax.faces.component.UIForm.processValidators(UIForm.java:170)

javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:91 2)

javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:91 2)

javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:91 2)

javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:91 2)

javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:342)

com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase .java:78)

com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)

com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)

javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)

sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)

java.lang.reflect.Method.invoke(Method.java:585)

org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)

java.security.AccessController.doPrivileged(AccessController.java:-2)

javax.security.auth.Subject.doAsPrivileged(Subject.java:517)

org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)

org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil terChain.java:257)

org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterCha in.java:55)

org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.ja va:161)

java.security.AccessController.doPrivileged(AccessController.java:-2)

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:157)

community_loan.SecurityCheckFilter.doFilter(SecurityCheckFilter.java:67)

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil terChain.java:210)

org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterCha in.java:55)

org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.ja va:161)

java.security.AccessController.doPrivileged(AccessController.java:-2)

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:157)

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 263)

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)

org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextVal ve.java:225)

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 173)

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:13 2)

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)

org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189)

com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask. java:604)

com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.ja va:475)

com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask .java:371)

com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264)

com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)

com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)

maan_alfudhail at 2007-7-6 22:32:09 > top of Java-index,Development Tools,Java Tools...
# 3
I am not sure whether this is your problem, but...Sometimes I don't see my JSP changes when I deploy and run. When that happens, I do a Clean and Build. This deletes all generated files and undeploys the app.
jetsons at 2007-7-6 22:32:09 > top of Java-index,Development Tools,Java Tools...