I have little more jsp experience than you, but I don't think this is such a
basic question. Coming from an ASP background, I got in the habit of
creating include files with JavaScript functions, particularly where the
same function might be shared by more than one page. When I tried to take a
similar approach with JSP, I soon discovered (thanks to jGuru) that the
methods declared have no access to any of the implicit objects of the JSP
service method, namely session, request, response, out, etc. If you don't
mind passing in the variables you need, that may be a good modular approach.
Then again, it may be a stupid way of making JSP behave like ASP. Maybe it
would make more sense to use a bean to process the form data and validate
passwords and such? Posting to a servlet and then redirecting seems a little
kludgy to me, but opinions may vary. I don't think there can be one answer
to your question, it seems more an issue of style.
John Blackmore
CMGI Solutions, Inc.
[EMAIL PROTECTED]
-----Original Message-----
From: Darren Siegel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 26, 2000 4:05 PM
To: [EMAIL PROTECTED]
Subject: Fw: Architecture Question
I have been implementing a web site using JSP for my company
and I have a few questions regarding some high level design
issues. I am the only person working on the site, so I went
with a Model I approach. My only real concerns are flexibility
of the site, if we need to add features down the road.
I'm implementing some standard login and user registration
pages, and I'm faced with the dilemma of how to (or even if I
should) separate the logic from the presentation. Initially
I coded a single JSP file to handle the user log in. The page
has a simple HTML form that would only post to itself. It handled
everything (making a call to a bean to login, displaying if there
was a success or failure, redirecting to the page that
originally required the log in, ...) in the process.
Should I separate this code into separate JSP's? Or what about
having the form post to a servlet which would handle the
login procedure, then redirect to separate result pages? The single
JSP file just seems to get very bulky, especially for the registration
page where I am doing password verification, and some more
involved field validation.
This is probably some really basic stuff, but I've only started doing this
a couple of weeks ago, so if anyone has any suggestions I would
be very grateful.
-Darren Siegel
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets