File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Action in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Action in struts" Watch "Action in struts" New topic
Author

Action in struts

Stephen Lee
Ranch Hand

Joined: Dec 11, 2001
Posts: 74
In struts, an Action class is subclassed to act as a controller. In the jsp page, it needs to display many records (obtained from database).
I am now thinking which method in the following 2 cases is better:
1) call the session bean in the subclass of Action class
2) the jsp page calls a javabean which call the session bean
Which method is better for the performance? In the code, it seems that it is better for the case 1, because the jsp page does not need to deal with the business logic. However, in case 1, after the Action obtained the data, I need to use this code: request.setAttribute("...", theObject).
Thanks!
Stephen Lee
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

When it comes to webapps, the two biggest drags on performance are generally DBMS latency and network delays. Compared to them, where you put your code is likely to be virtually indetectable.


Customer surveys are for companies who didn't pay proper attention to begin with.
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
As Tim says, you'll probably not notice any performance difference whichever you choose. From an architecture/design perspective, since you're using a Model-2 framework, you're better off accessing the session bean functionality from your Action class for increased reusability, maintainability, etc.
Cheers
Simon
Stephen Lee
Ranch Hand

Joined: Dec 11, 2001
Posts: 74
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action in struts