Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 in action Book question

 
BGirish Bapat
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Authors,
1. What are main advantages of struts2 over struts.
2. Why one should migrate / integrate his current running struts to struts2
and what are simple ways to do so.
-
Girish
 
Alaa Nassef
Ranch Hand
Posts: 471
Hibernate Mac OS X Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main advantages are:
1- Actions are POJOs, so they aren't coupled with any framework or container
2- Actions are not coupled with servlet API, so they are easily unit tested

A full comparison between struts 1.x and struts 2.x is available here. You can also take a look at the migration guide.
 
devarshm
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main reason I think are:
1. testing methodology
2. that it uses OGNL (Object Graph Notation Language) and valuestack technology
 
chad michael davis
Author
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The other folks have already pointed out several of the big improvements found in Struts 2, like POJO actions and decoupling of actions from Servlet API.

I would add that, in general, the entire framework demonstrates a cleaner architecture. Struts 2 is a very good case study in software engineering principles. All of the components in Struts 2 are cleanly separated from each other allowing, among many other things, easy testing of all framework components.

You can customize and add your own versions of all framework components with very little effort. For instance, the UI Component tags that come bundled with Struts 2 can be customized easily and cleanly. If you need the oupput of the bundled form tag to be in a different format or use different styling, you can easily customize the component to do what you need. The same holds true for even core components like the ObjectFactory that instantiates the actions and interceptors. The Spring plugin takes advantage of this to override the core objectfactory with one that looks for spring beans when its trying to come up with a given framework component.

So, I would say that a clean, highly flexible architecture is the hallmark of the new struts
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic