Monday October 20, 2003
Upgrading from Struts 1.1 to Nightly build I'm upgrading our application at work to the nightly build (20031020) of Struts in order to use the validwhen Validator. I found a few deprecations and errors in the process, so I thought I'd share to help others upgrade easier:
- ActionError has been deprecated in favor of ActionMessage. Likewise, ActionMessages.GLOBAL_MESSAGE replaces ActionErrors.GLOBAL_ERROR.
- Methods in ResponseUtils have been deprecated in favor of TagUtils' methods.
- RequestUtils.message has been deprecated in favor of TagUtils.message. Other methods include RequestUtils.lookup.
- Many of the methods in TagUtils aren't static (they where were in Request/ResponseUtils), so you have to create an instance of TagUtils. Anyone know the logic here?
- ValidatorResources.get deprecated in favor of ValidatorResources.getForm.
- ValidatorForm.getFieldMap() is gone, which no apparent replacement method (at least not in the JavaDocs).
- The Tiles' Controller interface's perform method has been deprecated in favor of execute. You gotta love this one - while perform has been deprecated, you must use it or you will get a compile error saying you must implement it (or declare your class abstract). Same goes for execute. So to upgrade, I had to implement both methods - where my perform method calls my execute method.
- org.apache.commons.lang.NumberUtils moved to org.apache.commons.lang.math.NumberUtils
- org.apache.commons.validator.ValidatorUtil moved to org.apache.commons.validator.util.ValidatorUtils
- stringToInt(java.lang.String) in org.apache.commons.lang.math.NumberUtils has been deprecated. Not according to the its JavaDoc.
Final tally - two deprecation errors that don't seem to have replacements (yet):
[javac] .../src/web/org/appfuse/webapp/filter/BreadCrumbFilter.java:182:
warning: stringToInt(java.lang.String) in
org.apache.commons.lang.math.NumberUtils has been deprecated
[javac] int mSS = NumberUtils.stringToInt(temp);
[javac] ^
[javac] .../src/web/org/appfuse/webapp/taglib/LabelTag.java:71: warning:
getFieldMap() in org.apache.commons.validator.Form has been deprecated
[javac] Field field = (Field) form.getFieldMap().get(fieldName);
Later: Thanks to Steve Raeburn (via the struts-dev mailing list), I now have no deprecation errors. NumberUtils.stringToInt(String) is now NumberUtils.toInt(String) and Form.getFieldMap().get(String) is now Form.getField(String). Thanks Steve!
Posted in Java
at Oct 20 2003, 10:22:00 AM MDT
2 Comments
Search This Site
Recent Entries
- Wine Tasting in Napa Valley
- How to build a Shot-Ski
- Bus Project Update
- Farewell to the 2011-2012 Ski Season
- Cruising around the Western Caribbean
- Spring Break!
- A Spectacular Trip to Stockholm and Madrid
- Comparing Web Frameworks and HTML5 with Play Scala at Jfokus 2012
- Play Framework 2.0 with Peter Hilton at Jfokus
- Secure JSON Services with Play Scala and SecureSocial
Posted by Yann Cebron on October 20, 2003 at 11:59 AM MDT #
Posted by Jason W on October 21, 2003 at 07:01 AM MDT #