DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39121>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39121





------- Additional Comments From [EMAIL PROTECTED]  2006-04-12 19:50 -------
There is another reported validator bug 38079 for dependencies being ignored.  
I have this covered on the javascript side but the server side was ignoring 
dependencies.  I suspect the reason was that JSF tries to convert the 
submitted value before passing on to the validator.  So, if you have assigned 
a converter to the component, it will validate the data type and report an 
error first.  Most of the dependencies have to do with type validation before 
another type of validation.

However, if there is not a converter assigned, the dependencies need to be 
invoked.  So, I started looking at doing this but ran into problems with the 
convention used for forming the formal parameter list for the invoking 
method.  The problem stated in this thread.  So, I put together some thought 
on how we might stylize this for JSF. 

Create a managed bean that is a place holder that holds a reference to the 
component the commons validator is associated with and an instance of the 
validator.  The map would be populated in the CommonsValidator validate 
method and cleared in a finally block in the same method.

<managed-bean>
    <managed-bean-name>shaleScope</managed-bean-name>
    <managed-bean-class>
      java.util.TreeMap
    </managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
</managed-bean>


Change the messages to allow EL parameterization.  The messages would utilize 
the managed bean described above to have full access to the component and 
validator properties.  This would also simplify the logic for determining what 
arguments should be used to create the message.

errors.date=#{shaleScope.validator.arg} is not a date.

Add an expression language extension to the comma delimited token list of 
methodParams.  The EL will be used to construct the arguments list for 
invoking the method.  

<validator name="date"
     classname="org.apache.shale.validator.CommonsValidator"
     method="isDate"
     methodParams="java.lang.String:#{shaleScope.component.submittedValue},
                   java.lang.String:#{shaleScope.validator.datePatternStrict}"
     msg="errors.date"
     jsFunctionName="validateDate"
     jsFunction="org.apache.commons.validator.javascript.validateDate"  
                
     depends=""/>

Any thoughts?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to