944,159 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 4393
  • JSP RSS
Jun 8th, 2005
0

best design

Expand Post »
I've created an html form that allows the user to login, or register.

Here is what I've thought about(just for the registration page, not login):

HTML FORM --> servlet ---> servlet calls java class that verifys the data, and shoves it into the database... ----> Makes a few tests --- > sends a dispatch to the jsp page that lets the user know it was succesful or not.

Is that good so far? I'm trying to seperate all the logic, but I'm not sure if the servlet should be there or not.

Data Layer -- > java class
Business logic layer(Sorft of) -- > servlet
present layer -- > jsp page

I'm basing it off of that, but I don't know if it makes sense what I'm doing?
Similar Threads
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Jun 20th, 2005
0

Re: best design

I think it sounds good. Just try to get the input checking away from the servlet and into the java class you're talking about. Java classes (beans) should have that responsibility, and servlet should dispatch the request to the appropriate jsp page, according to if the registration was successful or not. You could of course avoid the java class by putting everything in the servlet, but if you're thinking about reusing the servlet (Controller in the classical MVC pattern), you would be best served with keeping that file as small as possible.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
keibi is offline Offline
9 posts
since Jun 2005
Jun 24th, 2005
0

Re: best design

Almost right, but not quite how I'd prefer it.

Data is transmitted to a servlet. This servlet controls who is to process the data (based on request attributes probably).
It then forwards the data somewhere else for processing. This can be another servlet, a javabean, or even a JSP (in extreme cases like there's nothing to do but just show the data again).
This then tells the controller (if it's not displaying the data itself like a JSP would) which then decides what to do with the result (most likely this will be forwarding to a JSP or servlet for sending it back to the client).

You will likely be better off using a preexisting framework for all this. Something like Spring would serve well.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jul 10th, 2005
0

Re: best design

Should I use simpler technologies like javascript to do this?

Is there advantages of using cgi type scripts like servlets and jsp as opposed to simple validation with something like javascript?
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Jul 10th, 2005
0

Re: best design

Quote originally posted by server_crash ...
Is there advantages of using cgi type scripts like servlets and jsp as opposed to simple validation with something like javascript?
There is at least one very obvious advantage: Jacascript can be turned off on the client side, meaning that validation won't happen at at all. Always write applications that doesn't require javascript to be useable.

And, I agree with jwenting: A framework would help. Try out Spring ( http://www.springframework.com ), for instance. It takes some time to get into it, but it's well worth the time. You'll get it back in saved development hours.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
keibi is offline Offline
9 posts
since Jun 2005
Jul 10th, 2005
0

Re: best design

Javascript validation can be easily circumvented.

A classic (and true) story is an online store that used only Javascript validation.
A customer quickly found out what requests to send and was thus able to modify his order to a price of $1 for goods worth tens of thousands.

The company took him to court where the judge threw out the case on the grounds that a website is effectively a storeclerk and if a storeclerk charges you an amount that's what you have to pay.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jul 11th, 2005
0

Re: best design

I'm new to the javascript and html thing. I really don't think it's much fun I'm trying to find use for it. It's hard going from java to something like that

I believe I will try the Spring Framework. Probably be a while before I get around to it, as I've got a billion books to read.

Thanks guys.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: JSP pages not showing up
Next Thread in JSP Forum Timeline: Problem in loading new image





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC