Response inline... Jason Carreira wrote:
No worries...FormProc has been discussed as an option for validation in WebWork in the past, so I figured that you knew about it.Well, I didn't know it existed, for one :-)
In looking at it, it seems like it does too much. It seems to combineFormProc can do as much or as little as you like. If you only specify a validator then the values will only be validated. If you want to use FormProc to do type conversion then you can specify a type converter. This goes the same for storing the data (in a bean, hash map, etc),
bean population with validation. I'm also not sure how I feel about the
whole validation with any scripting language and RE's, etc. I actually
really kind of hate things that bundle BSF and allow scripting like
that. It's like .Net to me... Yes, you can write in multiple languages,
but it doesn't seem like a good idea.
Regarding alternative methods for validation: I believe that it is up to the developer using FormProc as to how they want to validate. The nice thing about FormProc is that you can do what you want with it.
That said, my mind could be changed. I have some attachment to my code,The actual integration with WebWork would probably have to be done by someone else as a.) I am not intimately familiar with WebWork, b.) I don't have a lot of time to work on it. The main reason I suggested FormProc was because it is mature and has already gone through issues like i18n.
but not enough that I wouldn't dump it if something better was there and
did what I wanted.
Can you describe how this could plug in where I have mine in place? It
would be called as an Interceptor after the parameters have been set
(both static configuration parameters and runtime request parameters).
It needs to be able to find configuration files (your framework also
uses XML files, I believe) for the Action class which act as defaults,
and alias specific configuration files which add to the defaults. This
should be dynamic, i.e. I shouldn't have to register the configuration
files in some master configuration file.
I don't think it would be exceptionally difficult to integrate FormProc and WebWork though. Your interceptor would need to call the method:
process(FormData[] formData, Locale locale) throws Exception;
...which is in the Form class. You can see an example of extending the Form class in the HttpForm class, which converts an HttpServletRequest to an array of FormData objects. The configuration is completely pluggable as well, by implementing the FormConfiguration interface. The FormManager class then allows you to add named configurations which are then retrieved when the Form by the same name is passed to the FormManager.configure() method.
There was also talk of an abstraction for pluggable validation. Anyone working on this yet?
So how good a fit is it?My thoughts are pretty clear at this point - unless you are going to do form validation in a vastly different fashion then you may as well take advantage of FormProc's maturity.
Also, has anyone looked at commons validator
(http://jakarta.apache.org/commons/validator/index.html)? It doesn't
seem to have any docs... From looking at the JavaDoc, it looks ok, but
it looks like it takes a little too much code to do it (it should be
seamless).
Thoughts anyone?
Sincerely,
Anthony Eden
-----Original Message-----
From: Anthony Eden [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 21, 2003 6:03 PM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] Validation Framework (checked into Xwork)
Jason,
Why are you writing a new validation framework when FormProc has already gone through these issues? Check out FormProc ( http://formproc.sf.net/ ) and let me know if their is something missing which would be necessary to make it fit WebWork developer needs.
Sincerely,
Anthony Eden
Jason Carreira wrote:
Don't have all of the answers there yet (glad to havehelp!), but what
I was thinking for i18n support was to change(triggered by a
<message value="my message"/>
To
<message key="message1">My default message</message>
Any thoughts on how to do parameterized messages? Maybe have:
<message key="message1">
<default>${0} is an invalid name</default>
<messageparam value="fooProperty"/>
</message>
Don't know... There's definitely more to be done here.
-----Original Message-----
From: Hani Suleiman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 4:02 PM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] Validation Framework (checked into Xwork)
How would you handle i18n support, and parametrised messages?
Eg, if you wanted '${0} is an invalid name' as your message
Quoting Jason Carreira <[EMAIL PROTECTED]>:
I checked a new validation framework into Xwork this morning that I
got running last night. It's based on some ideas like runtime attributes and deployment descriptors. What it does
all in theValidationInterceptor in the interceptor list for an action) is to load validation xml files for the action, in the following order, usingproperties
classloader.getResourceAsStream():
1) package/of/action/ActionName-validation.xml
2) package/of/action/alias-validation.xml
The xml file is parsed to create a Map of fieldname to List
(containing one or more FieldValidator's). FieldValidator is an interface with the following signatures:
void setMessage(String message);
String getMessage();
void validate(String propertyName, Action action) throws
ValidationException;
All validators have a message property, and can have other
(using the usual get/set naming) which will be set duringyou need.
configuration load time.
A validator.xml file looks like this:
<validators>
<field name="bar">
<validator type="required">
<message value="You must enter a value for bar."/>
</validator>
<validator type="int">
<param name="min" value="6"/>
<param name="max" value="10"/>
<message value="bar must be between 1 and 10."/>
</validator>
</field>
</validators>
The params here are set using Ognl into the properties of the
validator, so your validators can have whatever properties
Unlike Interceptors, which are (must be) stateless, Validatorsafter the
maintain the setup state in these properties and are cached
initial load for an alias and reused.out of your
What this allows is for you to pull all of your validation
actions and reuse it. It should make Actions even more simple and
straightforward. One other thing I've added (and this is
--------------------------------------------------------------------------------------------------------------Xwork code) is a ValidationAware interface that Actions canimplement
to get the error messages set into them by theFieldValidator's. It's
just the same method signatures from ActionSupport in WW.Otherwise,
the FieldValidator just logs the message (if it extendssomething else,
FieldValidatorSupport, that is. If you want it to do
then implement FieldValidator).scholarships. Get
Jason
--
Jason Carreira
Technical Architect, Notiva Corp.
phone: 585.240.2793
fax: 585.272.8118
email: [EMAIL PROTECTED]
---
Notiva - optimizing trade relationships (tm)
-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies! Can't
afford IT training? All 2003 ictp students receive
hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships. Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp
_______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
This SF.net email is sponsored by: Scholarships for Techies! Can't afford IT training? All 2003 ictp students receive scholarships. Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp
_______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
This SF.net email is sponsored by: Scholarships for Techies! Can't afford IT training? All 2003 ictp students receive scholarships. Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp
_______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This SF.net email is sponsored by: Scholarships for Techies! Can't afford IT training? All 2003 ictp students receive scholarships. Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
