• Post Reply Bookmark Topic Watch Topic
  • New Topic

database with struts 2 !  RSS feed

 
nik klaus
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm new to struts , but I 'am supposed to migrate(redevelop) to struts a web application for school.The application is based on servlets, database,javascript,jsp .The first problem that I can't tackle myself is how am I going to use the database in struts. In the old application I have a class that builds the database,if it hasn't already been build and functions that manipulate the data. I used an instance of this class in the servlet to perform various tasks, but I don't know how should the database in the various classes that will implement the actions.So what strategies are there available ? (if possible without using other technologies )
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts doesn't dictate what back-end one can use, so you're pretty much free to do whatever you want. What you have sounds like a typical Data Access Object. There shouldn't be any problem using such a thing with Struts.
 
André-John Mas
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be separating your project in two: the model and the viewer. Typically you would have a service that encapsulates the access to the data and then you struts front-end would make use of that service to access the data.

I have found the using Spring Persistence in addition to Struts works well, since you hand off the opening and closing of databases session to Spring.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!