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 ;-)