commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Betty Koon <bk...@adobe.com>
Subject Validator (please help)
Date Fri, 26 Mar 2004 01:08:30 GMT
Hi all,

I have followed the example in struts documentation (validwhen validaton
section).  I have an email address field that needs to be validated when one
other field's value is set to "true".  But I can't get it to work at all.

This is the example I cut and paste from struts web site.   I am getting the
following exception. See below.  Any idea?
Here is my version:
<field property="emailAddress" depends="validwhen">
      <arg0 key="userinfo.emailAddress.label"/>
        <var>
          <var-name>test</var-name>
          <var-value>((someFiled != 'some_value') or (*this* !=
null))</var-value>
        </var>
</field>

****************************************************************************
************************************************************************

As an example of how this would work, consider a form with fields
sendNewsletter and emailAddress. The emailAddress field is only required if
the sendNewsletter field is not null. You could code this using the
validwhen rule as:


<field property="emailAddress" depends="validwhen">
      <arg0 key="userinfo.emailAddress.label"/>
        <var>
          <var-name>test</var-name>
          <var-value>((sendNewsletter == null) or (*this* !=
null))</var-value>
        </var>
      </field>



14:22:36,603 ERROR [STDERR] line 1:23: expecting ''', found '_' 14:22:36,603
ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWhenLexer.nextToken(ValidWhenLexe
r.java:228)
14:22:36,603 ERROR [STDERR] at antlr.TokenBuffer.fill(TokenBuffer.java:69)
14:22:36,603 ERROR [STDERR] at antlr.TokenBuffer.LA(TokenBuffer.java:80)
14:22:36,603 ERROR [STDERR] at antlr.LLkParser.LA(LLkParser.java:52)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWhenParser.value(ValidWhenParser.
java:380)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWhenParser.comparisonExpression(V
alidWhenParser.java:434)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWhenParser.expr(ValidWhenParser.j
ava:415)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWhenParser.joinedExpression(Valid
WhenParser.java:446)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWhenParser.expr(ValidWhenParser.j
ava:420)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWhenParser.expression(ValidWhenPa
rser.java:406)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWhen.validateValidWhen(ValidWhen.
java:155)
14:22:36,603 ERROR [STDERR] at
sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source) 14:22:36,603
ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
14:22:36,603 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:324)
14:22:36,603 ERROR [STDERR] at
org.apache.commons.validator.ValidatorAction.executeValidationMethod(Validat
orAction.java:610)
14:22:36,603 ERROR [STDERR] at
org.apache.commons.validator.Field.validateForRule(Field.java:848)
14:22:36,603 ERROR [STDERR] at
org.apache.commons.validator.Field.validate(Field.java:927)
14:22:36,603 ERROR [STDERR] at
org.apache.commons.validator.Form.validate(Form.java:211)
14:22:36,603 ERROR [STDERR] at
org.apache.commons.validator.Validator.validate(Validator.java:407)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:151)
14:22:36,603 ERROR [STDERR] at
com.adobe.edc.server.presentation.fw.EDCActionForm.validate(EDCActionForm.ja
va:96)
14:22:36,603 ERROR [STDERR] at
com.adobe.edc.server.presentation.policy.AssignPermissionAction.addExternal_
onClick(AssignPermissionAction.java:200)
14:22:36,603 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 14:22:36,603
ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
14:22:36,603 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
14:22:36,603 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:324)
14:22:36,603 ERROR [STDERR] at
com.cc.framework.adapter.struts.FWAction.handleFormAction(Unknown Source)
14:22:36,603 ERROR [STDERR] at
com.cc.framework.adapter.struts.FWAction.execute(Unknown Source)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:462)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:267)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1187)
14:22:36,603 ERROR [STDERR] at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:451)
14:22:36,603 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
14:22:36,603 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
14:22:36,603 ERROR [STDERR] at
com.adobe.edc.server.presentation.util.SetCharacterEncodingFilter.doFilter(S
etCharacterEncodingFilter.java:147)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:213)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
14:22:36,603 ERROR [STDERR] at
com.adobe.edc.server.presentation.auth.AuthenticationFilter.doFilter(Authent
icationFilter.java:144)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:213)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:494)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
14:22:36,603 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
14:22:36,612 ERROR [STDERR] at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
14:22:36,612 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
14:22:36,612 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
14:22:36,612 ERROR [STDERR] at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
14:22:36,612 ERROR [STDERR] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
14:22:36,612 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
14:22:36,612 ERROR [STDERR] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
14:22:36,612 ERROR [STDERR] at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
14:22:36,612 ERROR [STDERR] at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
14:22:36,612 ERROR [STDERR] at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
14:22:36,612 ERROR [STDERR] at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:392)
14:22:36,612 ERROR [STDERR] at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
14:22:36,612 ERROR [STDERR] at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:619)
14:22:36,612 ERROR [STDERR] at java.lang.Thread.run(Thread.java:536)



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message