This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlets and database access - design considerations

 
rastas biggs
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic