|
Niall,
I would highly recommend adding documentation that mentions the fact that the now-deprecated method does not support bundles specified in <msg> elements. That gives the reader some indication of why it was deprecated, and why it is more appropriate to use the alternate method. -chris OK, any chance of a patch with what you would like to see?
I don't have the struts source code, and I would just add method javadoc, so I'll just drop in this comment if you don't mind. How about something like this, added to the method javadoc:
* * Note that this method does not respect any bundle information stored with the * field's <msg< elements, and so localization does not work properly. This method is * deprecated for this reason, and you should use * {@link #getActionMessage(Validator,HttpServletRequest,ValidatorAction,Field)} * instead. Had I seen this comment in the Javadoc, I would have been able to solve this problem myself without playing around too much. If anyone objects to the deprecation of this method, we could always re-write it to properly work with the bundle. In the "preferred" method, the Validator argument is used for no other reason than to get the ServletContext. Since /this/ method has access to the request, the ServletContext can be obtained from there just as easily. Maybe there's a reason to prefer the one available from the Validator object, but it seems like it's the same thing to me. -chris While looking at the source I noticed that there is no getActionError(Validator, HttpServletRequest, ValidatorAction, Field) method; and that the getActionError method that is there does not support bundles. Should it?
Chris,
I've added a warning based on your suggestion - thanks: http://svn.apache.org/viewvc?view=rev&revision=476419 Henri, There is no getActionError() method at all in Struts 1.3.x - it was deprecated in Struts 1.2.x and remove in Struts 1.3.x. Support for alternatvie resource bundles was only added in Struts 1.3 and hasn't been back ported to 1.2 (which is why the Validator dependency in Struts 1.2.x was left at Validator 1.1.4) |
|||||||||||||||||||||||||||||||||||||||||||
I agree that the old method should have been deprecated, which I have now done
http://svn.apache.org/viewvc?view=rev&revision=472736
Niall