User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,227 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 11097 | Replies: 33 | Solved
Reply
Join Date: Jan 2008
Posts: 32
Reputation: electron33 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
electron33 electron33 is offline Offline
Light Poster

Re: How to Connect MySQL from JSP Page

  #21  
May 5th, 2008
Sorry. Peter_budo has absolutly right. JSP has the presentation and Servlet has the logic.
Reply With Quote  
Join Date: Aug 2007
Location: Somewhere between heaven and hell
Posts: 86
Reputation: Kusno is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 6
Kusno's Avatar
Kusno Kusno is offline Offline
Junior Poster in Training

Re: How to Connect MySQL from JSP Page

  #22  
May 5th, 2008
Originally Posted by electron33 View Post
This class is the JSP. JSP is an extension of Servlet. Simply told. If you see a few pages up on this article you see how to create a connection in JSP. But as i already had sead. Don't use connection or other business related code inside JSP. It makes it more difficult to read Tags and Java code. Move the Connection and Query code down in a DAO layer and use Servlet class as controler. Put the data you want into a JavaBean and put it into Request or session. Get it back in the JSP page and view it. If you need help in how to implement it give me a reply


Dear Mr. Electron33,

Yes, I want to know how to implement it.

Please...
NEVER NEVER NEVER GIVE UP
Reply With Quote  
Join Date: Jan 2008
Posts: 32
Reputation: electron33 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
electron33 electron33 is offline Offline
Light Poster

Re: How to Connect MySQL from JSP Page

  #23  
May 5th, 2008
Here is an example of how I have done it so far. It is build in Netbeans 5.5
Attached Files
File Type: zip DatabaseConnection in JSP.zip (1.69 MB, 72 views)
Reply With Quote  
Join Date: Aug 2007
Location: Somewhere between heaven and hell
Posts: 86
Reputation: Kusno is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 6
Kusno's Avatar
Kusno Kusno is offline Offline
Junior Poster in Training

Re: How to Connect MySQL from JSP Page

  #24  
May 5th, 2008
Dear Mr. Electron33,

Thanks a lot for your help.

Kusno.
NEVER NEVER NEVER GIVE UP
Reply With Quote  
Join Date: May 2008
Posts: 3
Reputation: guymanbuddude is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
guymanbuddude guymanbuddude is offline Offline
Newbie Poster

Re: How to Connect MySQL from JSP Page

  #25  
May 20th, 2008
Originally Posted by electron33 View Post
Here is an example of how I have done it so far. It is build in Netbeans 5.5


Hi electron33, thank you for taking the time out to guide us newbies, but could you possibly explain to me how to run this?

The exception it keeps relaying to me is this:
"org.apache.jasper.JasperException: File "/WEB-INF/tld/c.tld" not found"
And I've no idea why, I can see the file myself, it is 2 directories deeper (ie. /WEB-INF/tld) than the current directory index.jsp is in.

I realise that to many this may seem like a very stupid question, but I have been trying in vein for quite a while at this!

Thanks in advance.
If it is at all useful, I'm hosting my MySQL database using Apache2Triad, and I'm using Tomcat.
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 191
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: How to Connect MySQL from JSP Page

  #26  
May 20th, 2008
Kiddo, we're not here to do your homework for you.
You quite obviously have no clue as to what you're doing, so start out with some beginner's tutorials.
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Join Date: Jan 2008
Posts: 32
Reputation: electron33 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
electron33 electron33 is offline Offline
Light Poster

Re: How to Connect MySQL from JSP Page

  #27  
May 20th, 2008
Originally Posted by guymanbuddude View Post
Hi electron33, thank you for taking the time out to guide us newbies, but could you possibly explain to me how to run this?

The exception it keeps relaying to me is this:
"org.apache.jasper.JasperException: File "/WEB-INF/tld/c.tld" not found"
And I've no idea why, I can see the file myself, it is 2 directories deeper (ie. /WEB-INF/tld) than the current directory index.jsp is in.

I realise that to many this may seem like a very stupid question, but I have been trying in vein for quite a while at this!

Thanks in advance.
If it is at all useful, I'm hosting my MySQL database using Apache2Triad, and I'm using Tomcat.


Hi again.

I understand that you are not familiar with Java and Jsp. If you are using Netbeans to develop your application, you have the possibility to add libraries to the Web application class path. What you need is a Jar library named JSTL (java standard tag library). Inside the Jar file you will find a folder named META-INF. Inside this folder you will find a file named core.tld. copy this file from the jar file and put it inside the tld folder under WEB-INF. If there is no folder create one and call it tld.

Start the application and it sould work fine.

By the way. If you are newbie I will recommend starting with some simpler examples and work your way up. I will recommend this site for all. http://www.java2s.com.
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,142
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 10
Solved Threads: 258
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is online now Online
Code tags enforcer

Re: How to Connect MySQL from JSP Page

  #28  
May 20th, 2008
Originally Posted by electron33 View Post
http://www.java2s.com.

I like that website and use it sometimes, however there are some problems
  1. 80% examples are just copy and paste cases from various books missing any explanation
  2. because of that simply useless to beginner that have to understand code to know what it does
  3. there are many cases of not working examples and admin is lazy to sort them (I actualy reported problem but no change)
  4. some code examples are out of date
All-in-all good quick resources if you know what you looking for, you better of with something like The Java EE 5 Tutorial
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 191
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: How to Connect MySQL from JSP Page

  #29  
May 21st, 2008
hmm, if the examples are all copied from books they're most likely guilty of plagiarism...
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Join Date: May 2008
Posts: 3
Reputation: guymanbuddude is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
guymanbuddude guymanbuddude is offline Offline
Newbie Poster

Re: How to Connect MySQL from JSP Page

  #30  
May 21st, 2008
Cheers Electron33 & Peter_Budo.

Got the interaction working so I can finally get on with my original intentions!

You're right about java2s though, it doesn't explain the code it has at all, which is quite annoying when you want to learn. But it is still useful.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JSP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 9:38 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC