• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how do I implement this Dao from my webpages?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please can somebody help me with my code...I want to develop a web app...that uses dao to encapsulate all the methods and connections so that the all calls are to to dao and not to database....so far its been okay but when I tried to make it into a singleton object, it threw errors ..precisely 3 errors...I want to know why...and also I want to be shown how to make calls to the method I have created in the dao from the servlet or Jsp pages.....just one (1) example each is okay....the code has been pasted below....please its urgent...Thanks in advance for your contributions.....




[edited to add code tags]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, I'm trying to look at your code, but the stubborn forum software has made it look all wonky. If you use CODE tags when posting code to the forums (see the FAQ at ⇒ UseCodeTags ⇐) they tell it "Hey! Keep your hands off my formatting!" and your code will look just like when you cut and pasted it into the reply. Cool, no?

Also, I've moved this to the JDBC forum as this is not a servlet issue.
 
dan steve
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so nobody could help in showing me how to implement my dao in servlets...when I was yet a novice, people would ask me on the platform to show what I can do ...now that I`m growing in knowledge, no one wants to help anymore.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course we would like to help out, that's what we're here for afterall!
You could do a better job of helping us help you by adding code tags as Bear requested.
This will make your post readable and we'll be good to go!

Tags or no tags, I quickly glossed over your code and it seems to me like you are stuffing way too much resposibilities into a single class, and making it a singleton doesn't seem like a stellar idea to me.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand what you are asking. How to instantiate a class in a servlet and call methods on it? Compared to writing the DAO itself, that should be something you already know how to do. So clearly I'm not interpreting the question right.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, before going on to how to call the DAO, does it work? In particular, "if(Dao == null) {" looks like it wouldn't compile.
 
dan steve
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Also, before going on to how to call the DAO, does it work? In particular, "if(Dao == null) {" looks like it wouldn't compile.



I have problems with the method calls...I have tried my best to make it work but nothing displays as output..it has no error but will not display...so I`m thinking may be I got it wrong somewhere....I called the methods like
Dao dao = new Dao();
dao.getDao();
dao.addMember(uName, pWord);
off course I declared strings uName and pWord in the servlet
and equate it using request.getParameter to the relevant textBoxes...
what else did I leave out..please..show me ..I`m a fast learner and I feel great to Have learnt all I have in Java, but there is stilla long way to go ..the point is....I`m just a beginner..but once I know I will never disturb you about it again..please help ..I have just a week to submit this final year project ...thanks in advance for your help...
 
What's a year in metric? Do you know this metric stuff tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic