best design
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?
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
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.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
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?
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
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.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
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 :sad:
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.
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20