Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Design Question

 
Andreas Sandberg
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Andreas Sandberg
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote this article recently for the JavaRanch Journal.
 
ak pillai
author
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic