• 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

Guidelines for Servlet Design?

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic