• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Access DAO from jsp

 
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I am working on a Struts based application and I have created DAO for use with getting data from a DB.

My problem is I dont know how to display my DAO parameters in the JSP. I have tried reading up tags but all I get is bean tags. DAOs are not beans

I have tried using the following code in my jsp but it doesnt work



Can anyone please help me?
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest, first understand What is Data Access Object (DAO) layer is used for, also what is the purpose of calling DAO in JSP
 
Ranch Hand
Posts: 2874
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a complement to the Siraj's post, DAO is something comes under Data Access Layer. Using DAO directly in JSP is something like killing the purpose. You are mixing the Presentation Layer with Data Access Layer.
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adeel Ansari:
Using DAO directly in JSP is something like killing the purpose. You are mixing the Presentation Layer with Data Access Layer.



agree with adeel.
do separate presentation from business logic, follow this for best practice and also makes your code more maintainable.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Saif uddin:
do separate presentation from business logic, follow this ...



Its better to replace "business logic" with "data manipulation logic", I suppose. Nonetheless, agreed.
 
pemi ola
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks all,

I will try and do as adviced.

But here is the scenario, I already have my DAO's, I have a blank struts application. I am building business logic and I dont want to start re-inventing the wheel.

I was hoping that I wont have to bog down the application with extra java classes to pass through.

Are you all suggesting that I leave my DAO's out of jsp's completely and instead create java beans that can use the DAO resources?

Please point me in the right direction.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to suggest few readings.

MVC, DAO, Transfer Object
[ February 14, 2007: Message edited by: Adeel Ansari ]
 
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic