42
Originally posted by Jeroen Wenting:
EJB are not needed.
Use JSP for displaying your data only. Use JSTL and maybe a few custom tags in the JSPs instead of scriptlets.
To retrieve the data use normal Java classes called from servlets (which then can prepare the data for the JSPs to show as well as process form data from the JSPs for storage in the database).
A simple system would have a central controlling servlet which forwards requests to other servlets as they come in based on knowhow about where they come from and what they want to do (you could use a single request attribute to indicate the desired destination for example).
Those servlets then process the request, retrieve and store data, and prepare the output. They then forward to the proper JSP which shows the data and the cycle starts again.
Originally posted by James Perry:
Many thanks Jeroen for the prompt reply and putting me in the right direction! I have a question though regarding your recommendation. The question may be due to ignorance but I was wondering why you would have one main controller servlet where you could have the requests forwarded specifiaclly to where the main controller would take them?
Originally posted by Allan Christensen:
Hi James,
I suggest that you have a look at the description of the FrontController Design Pattern (http://java.sun.com/j2ee/patterns/FrontController.html). It explains the rationale for your question.
Kind regards,
Allan
42
Originally posted by Jeroen Wenting:
that is the usual way of doing things.
Another way would be to fill a HashMap with the data for each record (keyed to some string, say a field name) and put all those in a List.
It amounts to the same thing but saves you from creating that bean (which may be overkill if it's a very simple bean with only 2 or 3 textfields).
Don't get me started about those stupid light bulbs. |