Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts Usage  RSS feed

Joby George
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
Pankaj Narang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • 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

Best Regards
md naveed
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!