• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Struts Usage

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am working in a company mainly concentrating in J2EE technology.We r planning to use struts for our new project.Can u tell about how to use struts framework for J2EE using WSAD
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Jobby

I think you are new to struts framework , there is not much difficulty in using struts framework in J2ee and WSAD.

let me explain how the flow goes if you want use struts with j2ee. I suppose that you are familiar with the basics of struts and ejbs.

In struts framework you have three layes i.e MVC . Your frontend comes in view which remain same in this case also. your next step is ACTION classes where you write your businees logic and call your databases .

now take the case of you are using j2ee i.e entity beans, session beans etc.
you know that your businees logic is fully impleimented in session beans and your client calls your session bean method through rmi and in that case your session bean interact with entity bean for any datbase interaction. this how the flow if you are doing a simple application in j2ee.\

Lets now take struts in your application,

1: Your frontend interacts with your action classes .

2:Your action classes acts as client for your session bean and hence interact with your session bean methods (Note here your business logic is now in session bean and you just call taht logic in action class which give response for the request from the clint)

3: Your sesion beans interact with entity beans for any database interaction.

now in short>>>>>

jsp are client for action classes ,

action classes are client for session beans

session beans are client for entiy beans

It is upto you if you want to put different patterns in between these layers
the best known pattern in this case is service locator pattern

I think you are clear with basic concept

Any further help you can post here or mail me at catchpankaj_n@yahoo.co.in

Best Regards
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi jobby,

struts is a frame work based on MVC-2 architecture.There is a slight difference between MVC and MVC-2.

MVC-2(Model View Controller -2)

If a user sends a request first the request goes to controller.Controller does certain processing based on the request which results in the model creation.Now this model is given to the view to display to the client.

Now where does struts come here.So struts frame work provides us with certain classes which can be used for controller,model and views.

controller:this is implemented as a servlet using the class ActionServlet.We have a helper object called Action.Action servlet on receiving the request from the user delegates the task of processing to Action class.In action class we have a method called execute whose return type is ActionForward.So the Action procees the request creates the model and the returns it to the view.Now view displays it.

For implementing model we can use java beans which uses set/get methods to store.

Views with the hepl of HTML,JSP...

We have web.xml and struts-config.xml(minimum)

In struts config.xml we specify the controller class.We specify on receiving the request whose Action must be called and on processing the request to which view it should be forwarded.All this info we give in this xml files.
This is what i understood about struts.

We don't have time for this. We've gotta save the moon! Or check this out:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic