Hi , I want to know that why should we use struts 2.x over struts1.x I know what is the difference between these two but from that i couldn't found why we should use struts2.x I felt that 2.x is bit hard to understand and interceptor concerns are very high in it.I feel it is more complex.
I have used Struts since it came out and recently picked up Struts 2. I think Struts 1 is easier to pick up, but it is less flexible. One ends up writing a lot of code to wedge business logic into the framework. Struts 2 has a bit more of a learning curve, but it has more features. Unfortunately, because it's very flexible it is also hard to get a grasp as to where to start. One big advantage for Struts 2 is that you don't have to override or implement an Action class. Just use a POJO. Less coding for the framework means you can be more productive on your app. Struts 2 does away with the ActionForm so you can use the same data beans in your front end and your business logic. Again, less coding for the framework. Interceptors aren't that big of a deal and they're really useful. Do you want session information in your action? Implement SessionAware. The session interceptor detects that interface and sets the session on your action. Need the servlet response, implement ServletResponseAware. Easy! Interceptors are also useful to take care of the repetitive set-up code you write for several actions. I made a Hibernate interceptor to handle setting up all my data processing actions. Don't like interceptors? You don't have to use them. One can get the session and response from the various context objects. I could have just as easily made a Hibernate base class and derive all my data processing actions from it. Again, the framework is really flexible. I put all the links that helped me learn Struts 2 on our Struts FAQ Page.