aspose file tools*
The moose likes Servlets and the fly likes Guidelines for Servlet Design? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Guidelines for Servlet Design?" Watch "Guidelines for Servlet Design?" New topic
Author

Guidelines for Servlet Design?

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Do you use any guidelines to design servlets in an application?
I mean do you use a single servlet to handle all form
actions(on end) or you use one servlet for each form
action(the other end)? Are there any performance issues etc.
that should be considered when designing?
Another quick question:
Is there any html tag that equivelant to jsp's include directive
to include another html file?
Thanks,
Peter
Brian Nice
Ranch Hand

Joined: Nov 02, 2000
Posts: 195
Microsoft FrontPage has an extension to allow for included files. Also, you can include pages using SSI (though different servers have different syntaxes for it) On IIS, you do:
<!--#include file=filname--!>
HTH
Brian
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"peter, pan",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Syed Kazim Hussain
Greenhorn

Joined: Dec 14, 2000
Posts: 8
Hi,
For including files in JSP use the RequestDispatcher object.
Such an object can be obtained by calling the ServletContext`s getRequestDispatcher() method.Then you can use the include() method of the RequestDispatcher object.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by peter, pan:
I mean do you use a single servlet to handle all form
actions(on end) or you use one servlet for each form
action(the other end)?

The most powerful approach IMHO is to have a single servlet (the controller) to handle actions. The servlet would dispatch the actions to command objects that implement the actual action. The whole thing is preferably controlled from a configuration file which lists, for each action/page combination, the commands to execute.
Controller and commands should all be stateless, so that they can be shared between all server threads. State belongs in the session and request objects.
Are there any performance issues etc.
that should be considered when designing?

Where do you want to start?
- Peter
narayan kulkarni
Greenhorn

Joined: Jan 31, 2001
Posts: 17
I did not have any guidelines set for when I started my first project based on servlets as server side program, but as I went on with design I found that it would be good to write one servlet each for one form to share between team members as it goes on with modularizing the design.
But I din't consider the performance issue, many people whom I consulted in this area were of the view that one form per servlet does not hinder the performance

This is a good topic for discussion
I would like for views of people working in this area
Peter, Can you please explain your design views in little more detail
Regards

[This message has been edited by narayan kulkarni (edited February 06, 2001).]


Take up computer programming as fun and you will just enjoy it. Always keep in mind that in some way your program is going to make human life easier.
 
 
subject: Guidelines for Servlet Design?
 
Similar Threads
request dispatcher
request and response
Request Dispatcher
Need to hook two servlets together, how do I do that?
including a file in jsp