Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta. developer.okta.com

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

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
Comments:

I really want to create a DynaActionForm from scratch. I have 1 dyna form being submitted, then depending upon what is in that form, I want to create a new form to then forward the user to the appropriate page, and use the values from this new DynaForm I created. How can I do this? I do not have access to the mapping object as your example describes as I am doing this operation in a Business Delegate and do not really want to pass the mapping object into this method.

Posted by Mick Knutson on February 10, 2003 at 11:23 PM MST #

It should be as simple as demonstrated - just replace <code>Constants.MESSAGE_KEY</code> with the name of your form in struts-config.xml.
FormBeanConfig cfg =
    mapping.getModuleConfig()
           .findFormBeanConfig("formNameFromStrutsConfig");

DynaActionForm messageForm =
    (DynaActionForm) DynaActionFormClass.createDynaActionFormClass(cfg)
                                        .newInstance();

Posted by Matt on February 11, 2003 at 05:43 AM MST #

Hi. I'm working in a personal project, and i'm using DynaValidatorActionForms, i don't know if what i will said is util for you, but here i go. I was so glass with DynaForms but when i needed to extend the DynaValidatorActionForms, and i tried to use my own Get Set methods on the jsp it dosen't found it.... What did i do? well what i'll gona do... ? So... i'll overwrite the initialize method to put new FormPropertyConfig beans to the FormBeanConfig... Do you think that it is a good idea?... Thks sorry for my bad english...

Posted by Hassan on December 13, 2004 at 05:18 PM MST #

Hi. I'm working in a personal project, and i'm using DynaValidatorActionForms, i don't know if what i will said is util for you, but here i go. I was so glass with DynaForms but when i needed to extend the DynaValidatorActionForms, and i tried to use my own Get Set methods on the jsp it dosen't found it.... What did i do? well what i'll gona do... ? So... i'll overwrite the initialize method to put new FormPropertyConfig beans to the FormBeanConfig... Do you think that it is a good idea?... Thks sorry for my bad english...

Posted by Hassan on December 13, 2004 at 05:18 PM MST #

Hi. I'm working in a personal project, and i'm using DynaValidatorActionForms, i don't know if what i will said is util for you, but here i go. I was so glass with DynaForms but when i needed to extend the DynaValidatorActionForms, and i tried to use my own Get Set methods on the jsp it dosen't found it.... What did i do? well what i'll gona do... ? So... i'll overwrite the initialize method to put new FormPropertyConfig beans to the FormBeanConfig... Do you think that it is a good idea?... Thks sorry for my bad english...

Posted by Hassan on December 13, 2004 at 05:40 PM MST #

Hi. I'm working in a personal project, and i'm using DynaValidatorActionForms, i don't know if what i will said is util for you, but here i go. I was so glass with DynaForms but when i needed to extend the DynaValidatorActionForms, and i tried to use my own Get Set methods on the jsp it dosen't found it.... What did i do? well what i'll gona do... ? So... i'll overwrite the initialize method to put new FormPropertyConfig beans to the FormBeanConfig... Do you think that it is a good idea?... Thks sorry for my bad english...

Posted by Hassan on December 13, 2004 at 05:41 PM MST #

Post a Comment:
  • HTML Syntax: Allowed