Originally posted by Luis Felipe Bacca Arango:
Hi, I usually create web applications using jsp, servlets, and java beans, actually i am studing ejb to extends my applications.
My questions is how struts improve my development process and how do i use to make a best practice with this.
Thanks all for your help.
I am not sure what kind of applications you tend to develop but the Struts framework assists in developing a model 2 MVC application where Struts acts as the controller for the application.
I have written my own controllers for fairly small applications and I know it becomes a pain to develop these. Struts allows you to configure your application flow using XML configuration files.
There are many other excellent features that come along with Struts such as declarative validation, additional exception handling to that of your business logic, use of tiles and much more.
Basically, when I first came acorss with JSPs and Servlets, there was not much resources on it. In old days, we usually put all codes inside a JSP or Servlet, which performs all logic for us.
For example, if a page that requires authentication for access is accessing by an unknown user, the JSP probably check whether the user is login, if not, it will redirect the user to, say, an login error page.
Thus, all logic are resided in a single JSP, which is not good for maintenance.
Then, after the invention of MVC, we have a JSP that for displaying data only, all logic are controlled by Servlets. However, this is not good enough as when logic changes, we need to modify the code as well.
Now, using Structs, we can have our own ActionForm, which contains the whole workflow, so that we dont need to hard code the workflow inside the Servlets or JSPs, and changing the flow just requires to change the XML-based Structs config. file. This makes our life become easier.
I am now working in a company that always keeping me up to the latest technologies. Whenever there are new technologies, where they have certification exams, my company will send me to the training courses, and get certified.
In addition, I am a part time research student, and my research area is Computer and Information Security.
Having the struts-config.xml eases things a lot. Also, on the JSPs, using the tags makes everything much easier and code looks a lot cleaner. I also like that you dont have to worry about controllers, handlers, dispatchers and such and that you forget mostly about setting and getting parameters directly from the request. You can focus on the business model.
It makes passing information much easier, because you know that the formbean has all the information you need.
On a very big application I was working on, we managed and used the Request object directly and it was very confusing, because we were a development team of 8, and sometimes I thought I was retrieving a parameter from the request, when I actually was retrieving a parameter that someone else had inserted.
If you have a good understanding of MVC, using Struts will not be hard.