开发者

Struts 1.x vs Struts 2.x

开发者 https://www.devze.com 2023-03-02 17:14 出处:网络
I have reviewed a few Struts 1 vs 2 questions on SO but none seem to answer the question in the perspective that I am looking at it with.

I have reviewed a few Struts 1 vs 2 questions on SO but none seem to answer the question in the perspective that I am looking at it with.

I am about to start work architecting a new system, a complete re-engineering of a very old desktop application. The goal is to make it web based, add more functionality, make it more usable etc (the usual reengineering reasons).

The team who will be developing the system are mainly Java developers and have worked on Struts 1.x extensively over the past 5 years.

The system is intended to live for many years to come, so the idea of re-engineering again in 3-5 years time when a better framework comes out is not an option. It is not intended to heavily use AJAX.

My question, is why would I bother moving to Struts 2 when my team are so experienced with Struts 1.x. I understand that there are some improvements, but I worry that the time lost in getting the team up to speed, rework due to incorrect usage etc will far outweigh any benefit we would get from Struts 2. We like Struts 1, it does what we need to it do, and all the design patterns, standards, best practices etc are in place.

Are there any killer features with Struts 2 or serious problems I don't know about in Struts 1 that w开发者_如何学Could sway the decision to stay with Struts 1.


If you are building a system from scratch I would definitely move onto version 2.x of Struts. The learning curve will not be great for a Struts 1.x team, but you will be able to take advantage of an up-to-date MVC framework.

For me the two main features of Struts 2.x which will enhance productivity are:

  • Built in AJAX support
  • No more ActionForms - you can bind directly into Domain Objects if you want, so this intermediate step has gone.

If it's a big project you're working on, you might want to look at a component framework e.g. JSF 2 or Wicket. If you're determined to stay on an Action based framework then I personally find Stripes a more productive framework.


Struts 1.x is 2000 vintage technology. Why on earth would you even consider sticking with it on a brand-new app?

The biggest drawback that I can see is that Struts locks you into a JSP-based, browser UI. Struts Actions are reusable only within the framework. You'll have a hard time seamlessly integrating a mobile device into that system if you need to.

I'd start thinking about web services, preferrably REST-based, and AJAX. The world has changed. I'd look into alternatives to Struts, like Spring or Play. Picking up a new web framework wouldn't be that big a deal, but the benefits could be worth it.

Those employees that have done nothing but work with an outdated framework for the last five years will thank you, too. Time for new skills.

UPDATE: If you've tried, and can't be late, and too many constraints, then I'd say you already know your answer. What are you hoping to get by coming here? I don't see an argument that you've failed to think through.


Given that your have a team with good experience in Struts 1.x and your product is stable as well, I don't see a great reason to migrate to Struts 2. Apache too seem to agree that http://struts.apache.org/roadmap.html#migrate_s1.


I'd think instead of asking "Stick with Struts1 or move to Struts2?" you'd better ask "Stick with Struts1 or move to a modern action based MVC web framework?". Why to move ? Because Struts1 is old and (frankly) sucks. Why not to move? Because we must learn a new framework. Granted, you know your resources, you must do the evaluation. But bear in mind that modern action based frameworks (Struts2, SpringMVC, Stripes) are quite easy to learn, and more so if your teams already knows Struts1.

Myself, I've have migrated from Struts to Struts2 and now I wouldn't like to return to Struts1 programming (those clumsy ActionForms!). I think Struts2 is much better. But one must also consider that Struts2 has also its weak points, the project does not seem very healty and the community does not seem very active. The jump from Struts1 to Struts2 is not big, but is not as small as a version change ("Struts2" is a misnomer), and it is probably not smaller that the jump to SpringMVC, so I'd suggest to consider it (or Stripes).


More Generally, Struts 2.x layered framework compare to Struts 1.x. For example in data layer , Struts 2.x has DO layer between VO and DAO.. Similarly other features are mentioned in the below link..

http://struts.fromdev.com/2008/08/struts-1-vs-struts-2.html ..

Since your team has more experienced with struts 1.x , i don't think it will take more time to migrate your code in to struts 2.x.

Please be specific what kind of difference u are expecting..


in struts2.0 there are more feature and advantage , in struts2.0 there is no form beam, a good and power full validation framework and most imported in struts2.0 for every request there is one instance of action but in sturts1.x only one instance of action for hole application.

so choice is yours . :)


Well the main reason is moving to struts 2.x in place of struts 1.x is struts 1.x is in maintenance phase now not in much active development.

now when it starts with a team who have good understanding of struts 1.x is that they will get the underlying system quickly.but before let me to put one point in a clear manner. struts1.x has no similarity with struts 2.x the only similarity is the name inherited from the parents. struts2 has following advantages.

  1. Action based framework
  2. A strong Ajax support
  3. Interceptors approach (core of framework) 4 Decoupled from the Serve let API which means plain POJO so unit testing will be much much easier

but my point is simple struts2 and struts1 only similar in terms of name but in terms of underlying architecture they are quite different.

0

精彩评论

暂无评论...
验证码 换一张
取 消