retrieving data from database into jsp page

Thread Solved

Join Date: Jul 2008
Posts: 50
Reputation: shijunair is an unknown quantity at this point 
Solved Threads: 0
shijunair shijunair is offline Offline
Junior Poster in Training

Re: retrieving data from database into jsp page

 
0
  #11
Sep 12th, 2008
hi stephens,
i promise you that i would go through the jdbc tutorial entirely and get all the concepts clear but right now i have to get this done as soon as possible.if you could just tell me how to write the code for now it would be a great favour.only for this time help me with the code for this particular scenario.Please help.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: retrieving data from database into jsp page

 
0
  #12
Sep 12th, 2008
That shows that you have not put in an effort to go through either of my links, why should I help you then, for a guy of average IQ that should be no more than an hours work and what guarantees that you will go through the tutorial when you no longer need it.
The major reason I am not revealing the mistake is cause the mistake is too simple.
Last edited by stephen84s; Sep 12th, 2008 at 2:58 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 50
Reputation: shijunair is an unknown quantity at this point 
Solved Threads: 0
shijunair shijunair is offline Offline
Junior Poster in Training

Re: retrieving data from database into jsp page

 
0
  #13
Sep 12th, 2008
ok stephens ,
I will do as you say, no matter it takes whatever time.Actually the moment you posted me the link i am going through that only but unfortunately i cant show you .I will go through that tutorial entirely and get the solution in which i am lacking
till then bye and thanks.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: retrieving data from database into jsp page

 
0
  #14
Sep 12th, 2008
First run Peter's Query in your DBMS and see how the results are displayed.

Next if your JDBC concepts are good go to my second link first (the one pointing to the javadocs of the ResultSet interface).

If the answer still doesn't click, then I guess you will need to go through the tutorial till you get what you want.

Trust me if you find and correct these small mistakes yourself, you will know how to go about larger problems.

Also I will tell you where you are going wrong you are expecting all the three parameters for SL,PL and CL in one row like:.
  1. PL CL SL
  2. 30 7 7


Whereas when you run the query given by Peter attached with the order by clause as shown here:-
  1. SELECT m_leavetype, m_bal
  2. FROM TABLENAME
  3. WHERE m_emp_no='1004' ORDER BY (m_leavetype);
Note the use of the order by clause to force the database to sort the way the records are stored in your ResultSet so that you will always get "cl", "pl" and "sl" in that order in your ResultSet and not in the order their rows were inserted.
You would get three rows like this:-
  1. m_leavetype m_bal
  2. cl 7
  3. pl 30
  4. sl 7

So you have to just change your code to search for CL,PL and SL vertically rather than horizontally(i.e in one row).
Last edited by stephen84s; Sep 12th, 2008 at 3:19 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 50
Reputation: shijunair is an unknown quantity at this point 
Solved Threads: 0
shijunair shijunair is offline Offline
Junior Poster in Training

Re: retrieving data from database into jsp page

 
0
  #15
Sep 17th, 2008
hi,
I have found the solution and i have rectified the mistake that i was making.I cant even believe that it was such a small mistake.But anyways thanks to you all.
bye
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,257
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 493
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: retrieving data from database into jsp page

 
-1
  #16
Sep 17th, 2008
Would you mind tell us what it was?
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: retrieving data from database into jsp page

 
0
  #17
Sep 17th, 2008
Hmmm ........... my crystal ball tells me my previous post was correct !!!


But I could be wrong cause I am using a cheap third world imitation of a crystal ball (a paper weight to be exact ).
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 50
Reputation: shijunair is an unknown quantity at this point 
Solved Threads: 0
shijunair shijunair is offline Offline
Junior Poster in Training

Re: retrieving data from database into jsp page

 
0
  #18
Sep 18th, 2008
hi stephens and peter,
Actually the same code which both of you provided was very much correct but i was doing mistake from my side. i was confused with the display part into the jsp page because when i was retrieving values from the database i was getting all the values properly but when i had to display into the jsp page i was taking the string value stored in session from the previous page and not from the database bcz of which it was giving me only the first row value. but finally bcz of your help i have found the solution .
thanks to both of you.
bye take care
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 34
Reputation: chicago1985 is an unknown quantity at this point 
Solved Threads: 0
chicago1985 chicago1985 is offline Offline
Light Poster

Re: retrieving data from database into jsp page

 
0
  #19
Oct 2nd, 2008
Originally Posted by peter_budo View Post
Have look at this tutorial. It is not finished yet, however you can use it for initial start
peter_budo,

Your tutorial is great! It fully explains MVC working with database and your descriptions are very clear and helpful. Thanks!!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,257
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 493
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: retrieving data from database into jsp page

 
-1
  #20
Oct 3rd, 2008
Originally Posted by chicago1985 View Post
peter_budo,

Your tutorial is great! It fully explains MVC working with database and your descriptions are very clear and helpful. Thanks!!
Thank you, however as mention previously tutorial is not done yet, I made some changes to database structure, deployed PeparedStatements plus some other things. All these require some post editing which I can not do now as I'm in process of finishing my MSc thesis. But on the end of October I should get back to it and finish it
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for JSP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC