I doubt anyone wrote something like that and I would refrain from writing it
myself too. This goes against good design practices. You do *not* want to have
different servlets having 75% (or more) of their code almost identical.
Look at your code and factor out common things (database access, validation,
etc.). Create common database pool for all your servlets. Create a class which
has methods for executing queries, updates that returns a generic ResultsBean
that you can use in JSP. And maybe a one dispatcher servlet that will handle
validation and then forward request to worker servlets.
With those things in place writing new servlets that access database will be
trivial:
- get new DatabaseAccess class
- create the query from submitted request, determine whether it's search or
update or something else
- crate new ResultsBean
- get results: ResultsBean = DatabaseAccess.search(query)
- put that bean in some context
- forward to JSP
thankyoudrivethrough
dave.
Lance Braud wrote:
> Every servlet that I write that accesses a database I have to write code for
> it to get and set each of the resultset fields, prepared statement
> parameters, and html form fields. Add validation to each of those as well.
> Does anyone know of a java package that can read a ResultSet and generate
> servlet source code and a basic html form for viewing and updating the
> resultset? If not, I'm going to have to write one and I'd be interested in
> hearing your ideas on what something like this should include so it would be
> useful to others. Has anyone come up with a good way to accomplish this
> already?
>
> Thanks,
> Lance
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
--
David Mossakowski [EMAIL PROTECTED]
Programmer 212.310.7275
Instinet Corporation
"I don't sit idly by, I'm planning a big surprise"
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html