• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts - MVC

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to struts. Please clarify the struts framework from the MVC architecture point of view.
Core application modules/Data Storage - Model
Action classes/Event handlers -- Controller
JSP forms/pages – View
How about the XML description files?
 
Author
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The XML decriptor files are used by the controller so that it knows what it should do with each incoming request. The controller also uses the information providing in the action-mappings to determine what instance of the action class needs to be instantiated, what form is associated with the action (and instantiate that class if need be), as well as what to do in terms of forwarding. The action mappings define the wiring of your application because each ActionForward that is returned from an action, has to be defined in the struts-config.xml somewhere. Whether it is a global-forward of action specific forward.
Check out chapters 2 & 6 for specifics on how to do various configuration tasks.
HTH
Sue
 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the benifits of using Struts as MVC pattern when compared to JSP(V) - Servlet(C) - Java Class(M) concept.

Thanks,
Anil
 
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Those of you on the struts-users list can skip the following--Copy&Paste rules.
1) How about this one from my RL experience...
I filled out a eBiz order form and mis-keyed my CC exp date. My transaction was rejected, and I was returned to the form... with nothing in it! I had to re-key everything. The Struts HTML tags take care of this problem for you, rather than having to trust that the browser will cache it or the user won't mind re-keying everything. HINT: If a user has to re-key something, they probably won't, resulting in lost business.
2) The key is that Struts helps you control the flow. You can skeleton out a whole app before it's even possible to write the business logic. I speak from experience here--I had a whole app laid out and assembled 6 months before the DBA's finished the schema for my data mart. I dropped in the logic, and voila, everything worked. Struts is *not* a business logic framework. It *is* a VC framework, waiting for your M. =) Trust me when I say once you learn it, it will save you time.
3) The key here is that Struts does everything for you that you'd have to write yourself.
If you want to write it yourself, feel free. Meanwhile, I've got a set of wheels and I'm off building apps. =)
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, does that mean that struts are about patterns and we are likely to see an array of standard patterns emerge in the Enterprise world?
 
Ranch Hand
Posts: 314
2
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
Patterns, eh? Here is an interesting read...
In pp. 577-578 of Manning's book on Struts, the author provides a list of well-known design patterns and states how they are implemented in Struts. The list is as follows:
Pattern: Service to Worker
Struts Component: ActionServlet, Action
Pattern: Command, Controller, Front Controller, Singleton, Service Locator
Struts Component: ActionServlet, Action
Pattern: Dispatcher, Navigator
Struts Component: ActionMapping, ActionServlet, Action, ActionForward
Pattern: View Helper, Session Facade, Singleton
Struts Component: Action
Pattern: Value Object, Value Object Assembler
Struts Component: ActionForm, ActionErrors, ActionMessages
Pattern: View Helper
Struts Component: ActionForm, ContextHelper, tag extensions
Pattern: Composite View, Value Object Assembler
Struts Component: Template taglib, Tiles taglib
Pattern: Synchronizer Token
Struts Component: Action
Pattern: Decorator
Struts Component: ActionMapping
Very interesting!
Darryl
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


What are the benifits of using Struts as MVC pattern when compared to JSP(V) - Servlet(C) - Java Class(M) concept.


Struts is a web application framework that encourages MVC application arcitecture. The framework is used to build web applications based on the MVC architurural pattern. It comes along with other useful things that would be nightmare for any developer (or team of developers) to implement and maintain like validation, request control, view layout. Struts include those extra stuff as part of its framework.
Why re-invent the wheel again?
 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Because framework manufacturing is a bit of a cottage industry :-)
Darryl
 
reply
    Bookmark Topic Watch Topic
  • New Topic