Re: My dilema: Much improved version of requiredif ready, 1.1 or 1.2?

2003-03-06 Thread Erik Hatcher
Just food for thought:

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-nametest/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]


RE: My dilema: Much improved version of requiredif ready, 1.1 or 1.2?

2003-03-06 Thread David Graham
James,
I haven't even been able to figure out requiredif!  I think your feature is 
great but we need to show some discipline and maintain the 1.1 freeze.  IMO, 
this should be a definite addition for 1.2.

I have no idea about the issues with JavaCC.  Does it mean that there's no 
source file, just a generated class file?

Dave



From: James Turner [EMAIL PROTECTED]
Reply-To: Struts Developers List [EMAIL PROTECTED]
To: 'Struts Developers List' [EMAIL PROTECTED]
Subject: RE: My dilema: Much improved version of requiredif ready, 1.1 or 
1.2?
Date: Thu, 6 Mar 2003 01:42:25 -0500

Actually, I realized just after I sent this that if I took the required
part out and called it validwhen instead, you end up with a true general
purpose validation tool!  So that's the one I'm proposing.  Basically,
if you had a field lastName that was required if firstName was filled
in, you say:
((lastName != null) or (firstName == null))

I.e., the field is valid if it isn't null, or the firstName field is
null.
This means you can generate an error on a field based solely on the
values of other fields.
James



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


_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


RE: My dilema: Much improved version of requiredif ready, 1.1 or 1.2?

2003-03-06 Thread James Turner
 James,
 I haven't even been able to figure out requiredif!  I think 
 your feature is 
 great but we need to show some discipline and maintain the 
 1.1 freeze.  IMO, 
 this should be a definite addition for 1.2.

I can live with that, I can stick it in the nightly build after we
finally ship this puppy.

 I have no idea about the issues with JavaCC.  Does it mean 
 that there's no 
 source file, just a generated class file?

It generates Java files from a .jtt grammer description file (much like
yacc/bison works).  I can check in both the .jtt file and the generated
java files.

James



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



My dilema: Much improved version of requiredif ready, 1.1 or 1.2?

2003-03-05 Thread James Turner
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-nametest/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]



RE: My dilema: Much improved version of requiredif ready, 1.1 or 1.2?

2003-03-05 Thread James Turner
Actually, I realized just after I sent this that if I took the required
part out and called it validwhen instead, you end up with a true general
purpose validation tool!  So that's the one I'm proposing.  Basically,
if you had a field lastName that was required if firstName was filled
in, you say:

((lastName != null) or (firstName == null))

I.e., the field is valid if it isn't null, or the firstName field is
null.

This means you can generate an error on a field based solely on the
values of other fields.

James



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