CategoryDAO dao = (CategoryDAO) WebApplicationContextUtils.getWebApplicationContex t(this.servlet.getServletContext()).getBean("Categ oryDAO");
You can use org.springframework.web.struts.ActionSupport, then the previous line will read
Code:
CategoryDAO dao = (CategoryDAO) webApplicationContext.getBean("CategoryDAO");
I would have preferred using a prototype bean so that I can do something like this:
Category category = ...getBean("Category");
But then I need to setup the bean using:
category.setName(form.getName());
why would you use Spring DI to create your business objects? It is (I think) easier to use
Code:
Category category = new CategoryImpl ();
But then I need to setup the bean using:
category.setName(form.getName());
well, you can use Jakarta Commons BeanUtils. Struts heavely uses/recommends it
Code:
BeanUtils.copyProperties (category, form);
no additional jars will be needed as struts requires BeansUtils.