File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlets and database access - design considerations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlets and database access - design considerations" Watch "Servlets and database access - design considerations" New topic
Author

Servlets and database access - design considerations

rastas biggs
Ranch Hand

Joined: Sep 24, 2004
Posts: 41
Hi,

I have a simple app that uses jsp taglib to display data from a database.

My App works fine but I have linited experience and was wanting to know some other people opion on my design approach.

The app basically from the tag lib call a bean that contains a method that connects and queries the databnase closes the record set etc..and returns an ArrayList of Strings, which is displayed in a jsp via the tag lib.

Now my question here is is just using a bean to access the DB ok and returning the data in an ArrayList Ok, or this there a better approach to doing this?

Ras
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
What you're doing is a good step on the correct path.
You should however not do database access (even in this manner) from a JSP.
Rather do it from a servlet (through your bean) and set the List in the request or session, then forward to the JSP and use that to display the data.


42
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlets and database access - design considerations
 
Similar Threads
new option() and &
on logic:iterate tag
If database connection not open JSP fails
POJO Vs EJB what is the best approach
New Project EJB Vs Corba