How about using the OGNL expression language (www.ognl.org) rather than writing your own parser? WebWork, Tapestry, and certainly others, are using OGNL. (and the creator of it is a good friend of mine!)
Erik
On Thursday, March 6, 2003, at 12:56 AM, James Turner wrote:
As I'm sure we've all noticed, the "requiredif" validation, although seeming to be very popular, is a bear for first time users to comprehend. With that in mind, I've just finished a new validation (which I'm calling "requiredwhen" to avoid confusion), which is much simpler. Here's a sample rule:
<field property="firstName" indexedListProperty="dependents" depends="requiredwhen"> <arg0 key="dependentlistForm.firstName.label"/> <var> <var-name>test</var-name> <var-value>(dependents[].lastName != null)</var-value> </var> </field>
As you can see, you can now put any arbitrary booolean expression as the
test for required. For example:
((dependents[].lastName == "James") and (options[1] == "true"))
If the parser sees "[]", it replaces it with the indexed property value of the target field.
Here's the dilema. I think it's a lot better than "requiredif", will generate a lot less questions on struts-users, and let people do the general types of checking they seem to want to do. Also, since it's just another rule being added to the Validation set, it shouldn't be able to destabilize anything else in the release. However, since it is a new feature, I hesitate to add it to 1.1 because we're in freeze.
What do other people think? Also, I used JavaCC to generate the parser,
there's should never be a need to regenerate the java files from the jtt
source, but should someone want to do it, they'd need to download
JavaCC. Will this be a problem?
James
New Gig! | | | | | | | | \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ V V V V V V V V Director of Software Development Benefit Systems, Inc. [EMAIL PROTECTED]
Voice: 603-216-1620 Fax: 317-573-2016
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]