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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16401

ActionValidatorUtil





------- Additional Comments From [EMAIL PROTECTED]  2003-09-12 00:31 -------
1. Why do you catch ValidatorException and create a new Exception with its 
message?

This was to avoid having to have a try catch block in the Action when i used 
it. If we incorporate access to the util into the base Action class i will 
catch it in the Action method that accesses it and/or have the method throw an 
generic Exception.



2. As much code as possible should use ActionMessages instead of ActionErrors. 
ActionErrors is only still around because it's part of ActionForm.validate()'s 
API.

I thought that was the case. But, i was unsure about the direction of the 
Messages API. I can change that.



3. request.getSession().getServletContext() is a Servlet 2.3 feature so we need 
a different way of getting the ServletContext().

Well, if we make access to the util part of the base Action then there would be 
no need to get the context via the request. We could pass the servlet reference 
into the util in order to get at the context.



4. Maybe these methods should go into Action instead of a util class.  Action 
knows about its Servlet which can get you to the ServletContext.

I agree. I wrote the util because i didn't want to create my own build of 
Struts and needed to use it immediately. However, i think instead of including 
the code in the action itself it should remain a util and the action should 
have a method that calls the util to perform validations... much like the 
ActionForm.



5. If we do go with a util class it should be a Singleton with non-static 
methods.  Statics don't allow for subclassing and specialization which someone 
will need (we learned this the hard way).

Absolutely no question about it. I agree. Again, i looked at some of the 
current patterns being used in struts and made the decision toward static based 
on other struts utils. However, i am quite aware of the annoying limitations of 
statics.



I can make the Util extendible as a singelton. Is there a particular 
implementation of the Singleton pattern that the struts dev group is fond of? 
Otherwise, I can provide it as a singleton and see if it meets your criteria.

Also, I will write a patch that integrates use of the util into the base Action 
class.

Does this all sound good?

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

Reply via email to