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
- Secure JSON Services with Play Scala and SecureSocial
- My What's New in Spring 3.1 Presentation
- Twitter's Open Source Summit: Bootstrap 2.0 Edition
- Refreshing AppFuse's UI with Twitter Bootstrap
- 2011 - A Year in Review
- Upgrading AppFuse to Spring Security 3.1 and Spring 3.1
- What have I been working on at Taleo?
- Our Engaging Trip to Paris and Antwerp
- My HTML5 with Play Scala, CoffeeScript and Jade Presentation from Devoxx 2011
- Deploying Java and Play Framework Apps to the Cloud with James Ward
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 #