This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes how do I implement this Dao from my webpages? 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 » Databases » JDBC
Bookmark "how do I implement this Dao from my webpages?" Watch "how do I implement this Dao from my webpages?" New topic
Author

how do I implement this Dao from my webpages?

dan steve
Greenhorn

Joined: Feb 12, 2011
Posts: 7
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]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
dan steve
Greenhorn

Joined: Feb 12, 2011
Posts: 7
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.
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1756
    
    7

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.

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

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

Joined: Feb 12, 2011
Posts: 7
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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do I implement this Dao from my webpages?
 
Similar Threads
returning an int
data mismatch error
Reconnecting to Database
The value for the useBean class attribute "..." is invalid.
Statement is closed?