aspose file tools*
The moose likes Servlets and the fly likes Servlets and Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlets and Struts" Watch "Servlets and Struts" New topic
Author

Servlets and Struts

John Ryan
Ranch Hand

Joined: Mar 14, 2001
Posts: 124
Hi,
I just wanted to enquire if many people have experience of using the struts framework with their servlets. What are the advantages of this over pure servlet programming?
Thanks
John
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Struts is based on MVC (Model-View-Controller)pattern which reduces the coupling betwen various components.
The Contoller is represented as Servlet(maps the user action as functions on the model),the view as JSP (renders the content of the model)and model as action classes and java beans.struts is based model 2 architecture and increases the maintainability of a web site.
Struts has a learning curve but is useful in a long run.
For more info visit http://apache.org
[ May 21, 2002: Message edited by: Pradeep Manjeshwar ]

Groovy
Stephen Peterson
Ranch Hand

Joined: Dec 25, 2000
Posts: 33
I looked into Struts awhile back for applicability to my JSP application. I use model 2, in the sense that I have a single Servlet controller that forwards reqests to various Java Handlers, which call the model, then flow to a JSP page for presentation.
My JSP pages though have a variable number (0 to 15 or more) of HTML input elements of various types: text areas, text fields, href anchors, and buttons, depending on run-time information read from a database. Each page represents a row of a database table, and allows browsing, update, insert, or detete operations on a row of the database table, sometimes per additional business rules, also read from a database table.
My reading seemed to indicate that this design would not be adaptable to Struts, since an assumption is made (as also seems to be with EJBs) that the number of fields in a JSP page is known at compile-time. Is this the case?


United Health Group<BR>Hartford, CT, USA
Stephen Peterson
Ranch Hand

Joined: Dec 25, 2000
Posts: 33
I looked into Struts awhile back for applicability to my JSP application. I use model 2, in the sense that I have a single Servlet controller that forwards reqests to various Java Handlers, which call the model, then flow to a JSP page for presentation.
My JSP pages though have a variable number (0 to 15 or more) of HTML input elements of various types: text areas, text fields, href anchors, and buttons, depending on run-time information read from a database. Each page represents a row of a database table, and allows browsing, update, insert, or detete operations on a row of the database table, sometimes per additional business rules, also read from a database table.
My reading seemed to indicate that this design would not be adaptable to Struts, since an assumption is made (as also seems to be with EJBs) that the number of fields in a JSP page is known at compile-time. Is this the case?
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
We also looked at struts and there are a lot of assumptions and techniques that have to be made in order to even USE struts. Example, we work with clients who use anything from Websphere, to Weblogic, to NetBeans, to JBuilder, to Textpad for java development.
Most of the commerical design tools also "force" you into their design model and process and thus make it very difficult, albeit not impossible, to use struts in their environments, however, this only increases the process of getting a project to completion rather than taking advantage of the "rapid" nature of struts.
Especially if you "cut you teeth" on java in those environments to begin with...
Bottom line, if you want to use struts, forget the dev. environment and use TextPad to begin with, then once you have it down, put the two together and use your dev. environment...
John Ryan
Ranch Hand

Joined: Mar 14, 2001
Posts: 124
So if not using the Struts MVC pattern you could possible end up retrieving data and setting up your view (JSP, Html) within the one class. I have used MVC before and found it helps create cleaner code alright.....
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
I am on the portal team at Indiana University and we just finished round 1 of our enterprise portal. It is written in java using struts and we have over 100,000 students, faculty and staff + more that 400,000 alums that can use this. So far so good with the scalability and all. Check it our (through the guest access mode) and let me know what you think or if you have any questions.
https://onestart.iu.edu


scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
 
 
subject: Servlets and Struts