aspose file tools*
The moose likes Servlets and the fly likes Servlet Design Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Design Question" Watch "Servlet Design Question" New topic
Author

Servlet Design Question

Andreas Sandberg
Ranch Hand

Joined: Sep 14, 2005
Posts: 31
Hi Folks,

I'm working on project and have a design question I was hoping I could get help with. Basically, I have created a small application that about 200 users will be using to input work log information. The main page allows the users to submit information and the information is then displayed back to the user on the same screen so they have the option to see what they've submitted and make updates. They can of course continue to enter new information. (Basically just adding continuously to a table) I'm wondering what the best way is to handle how to store the user input. Right now the validation is all done with JSF and then I forward the response to a servlet which stores all the input within a vector. The vector is stored as a session object. When the user clicks save, the vector is saved to the database. This doesn't seem like the most elegant way to handle the situation and I'm wondering if I should use a bean or perhaps even an EJB? I'm new to J2EE and there has been a lot of information to take in, especially in such a short amount of time so any advice/input is appreciated. THANKS!!!

Andreas


"When the compilers not happy ain't nobody happy"
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
This is not an easy question !

To make your life easier if you can i propose you to look at existing framework.

First for the MVC :there are lots of ! i've used some, based on jsp (struts,webwork) but there are probably other for JSF

Then an ioc container (a bean factory ): Spring is the most used but other can be used
Last an pesistence framework: You also have the choice : hibernate , jdo ,.......... or better if you can already used the new specification jpa. I will not advice you to use ejb version 2 for you persistence mechanism.

The principe is the same and based on model . You create some pojo Your MVC framework help you to manipulate this on the web and your persistence framework will help you to save and read from the db.And your IOC will be used to decouple the two part !


your question is so large and my answer is so small
But i hope it helps.

[ July 11, 2006: Message edited by: Benjamin Leonard ]
[ July 11, 2006: Message edited by: Benjamin Leonard ]
Andreas Sandberg
Ranch Hand

Joined: Sep 14, 2005
Posts: 31
Thank you! I will look into using hibernate and spring and this seems to be a fairly popular choice at the moment. Any opinons regarding struts? So much to learn, so litle time Thanks again.

Andreas
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

Personally I think you should avoid using any framework until you have a thorough understanding of JSP, servlets and proper web application structure. Then you can decide if, and if so, which framework might be appropriate.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Andreas Sandberg
Ranch Hand

Joined: Sep 14, 2005
Posts: 31
Hi Bear,

When you mention web app structure do you know of any good tutorials or reading material? I've gotten jsp's and servlets down pretty good and do have my application working. From a design point of view though I'm not very happy with it as I feel it's a bit sloppy, even though I've tried to implement things according to the MVC model 2 design pattern. I have a main servlet acting as a request dispatcher but the way I'm making my calls to the database is very ugly. Thanks!!!

Andreas
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

I wrote this article recently for the JavaRanch Journal.
ak pillai
author
Ranch Hand

Joined: Feb 11, 2006
Posts: 288
Hi Bear Bibeault

I wrote this article recently for the JavaRanch Journal.


It is an excellent article on the MVC. Also would be nice to cover session synchronization token pattern in addition to the PRG pattern.


java j2ee job interview questions with answers | Learn the core concepts and the key areas
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Design Question