Monday January 06, 2003
Upgrading to Struts 1.1b3 - Tips I upgraded one of my client's applications from Struts 1.1b2 to Struts 1.1b3 tonight. It was a small headache, but not too bad. As far as the differences b/w 1.1b2 and 1.1b3 - they're pretty significant. Some classes/methods are downright gone - not just deprecated, but gone. Oh well, that's why it's a beta - and it's free, so who's complaining? I'll try to remember a few issues I found. The first is how to create a DynaActionForm. The code below worked with 1.1b2:
DynaActionForm messageForm =
(DynaActionForm) DynaActionFormClass.getDynaActionFormClass(
Constants.MESSAGE_KEY).newInstance();
But the getDynaActionFormClass method is now gone, so you have to use this:
FormBeanConfig cfg =
mapping.getModuleConfig()
.findFormBeanConfig(Constants.MESSAGE_KEY);
DynaActionForm messageForm =
(DynaActionForm) DynaActionFormClass.createDynaActionFormClass(cfg)
.newInstance();
A few deprecation errors cropped up as well.
- Action.MESSAGE_KEY -> Globals.MESSAGE_KEY
- Action.ERROR_KEY -> Globals.ERROR_KEY
- org.apache.struts.validator.StrutsValidatorUtil -> org.apache.struts.validator.Resources
Finally, I found an issue with using BeanUtils.populate(dest, orig). It worked fine with 1.1b2, but throws a NPE with 1.1b3. I replaced this with BeanUtils.copyProperties(dest, orig) and everything works as it should. My guess (from doing a toString() on the orig) is that "multipartRequestHandler=null" was messing things up.
It's interesting doing maintenance/enhancements on code that I wrote a year ago. I've learned sooooo much since then. I wish I could go back and re-factor a bunch, but my client would never go for it - it works right?! Maybe I'll refactor some for kicks - just to see if it's possible. I'd love to replace a few DAOMySQL's with DAOHibernate's ;-) Posted in Java at Jan 06 2003, 11:16:48 PM MST 6 Comments
Search This Site
Recent Entries
- Jack's Mohawk
- LinkedIn Cuts 10% (a.k.a. The Journey is Over)
- Happy Birthday Abbie!
- Moving from Spring's XML to Annotations in AppFuse
- Free Maven Training in New Orleans on Election Day
- AppFuse Light ยป AppFuse, Maven Archetypes and Shared Web Assets
- Great Weekend in Montana
- Colorado Software Summit 2008 Wrapup
- RESTful Web Applications with Subbu Allamaraju
- Core Animation with Bill Dudney
Posted by Mick Knutson on February 10, 2003 at 10:23 PM MST #
FormBeanConfig cfg = mapping.getModuleConfig() .findFormBeanConfig("formNameFromStrutsConfig"); DynaActionForm messageForm = (DynaActionForm) DynaActionFormClass.createDynaActionFormClass(cfg) .newInstance();Posted by Matt on February 11, 2003 at 04:43 AM MST #
Posted by Hassan on December 13, 2004 at 04:18 PM MST #
Posted by Hassan on December 13, 2004 at 04:18 PM MST #
Posted by Hassan on December 13, 2004 at 04:40 PM MST #
Posted by Hassan on December 13, 2004 at 04:41 PM MST #