943,589 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Marked Solved
  • Views: 16855
  • JSP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Sep 12th, 2008
0

Re: retrieving data from database into jsp page

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.
Reputation Points: 8
Solved Threads: 0
Junior Poster in Training
shijunair is offline Offline
50 posts
since Jul 2008
Sep 12th, 2008
0

Re: retrieving data from database into jsp page

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.
Featured Poster
Reputation Points: 653
Solved Threads: 151
Nearly a Posting Virtuoso
stephen84s is offline Offline
1,316 posts
since Jul 2007
Sep 12th, 2008
0

Re: retrieving data from database into jsp page

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.
Reputation Points: 8
Solved Threads: 0
Junior Poster in Training
shijunair is offline Offline
50 posts
since Jul 2008
Sep 12th, 2008
0

Re: retrieving data from database into jsp page

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:.
JSP Syntax (Toggle Plain Text)
  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:-
sql Syntax (Toggle Plain Text)
  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:-
JSP Syntax (Toggle Plain Text)
  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.
Featured Poster
Reputation Points: 653
Solved Threads: 151
Nearly a Posting Virtuoso
stephen84s is offline Offline
1,316 posts
since Jul 2007
Sep 17th, 2008
0

Re: retrieving data from database into jsp page

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
Reputation Points: 8
Solved Threads: 0
Junior Poster in Training
shijunair is offline Offline
50 posts
since Jul 2008
Sep 17th, 2008
-1

Re: retrieving data from database into jsp page

Would you mind tell us what it was?
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 871
Code tags enforcer
peter_budo is offline Offline
6,653 posts
since Dec 2004
Sep 17th, 2008
0

Re: retrieving data from database into jsp page

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 ).
Featured Poster
Reputation Points: 653
Solved Threads: 151
Nearly a Posting Virtuoso
stephen84s is offline Offline
1,316 posts
since Jul 2007
Sep 18th, 2008
0

Re: retrieving data from database into jsp page

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
Reputation Points: 8
Solved Threads: 0
Junior Poster in Training
shijunair is offline Offline
50 posts
since Jul 2008
Oct 2nd, 2008
0

Re: retrieving data from database into jsp page

Click to Expand / Collapse  Quote originally posted by peter_budo ...
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!!
Reputation Points: 10
Solved Threads: 0
Light Poster
chicago1985 is offline Offline
36 posts
since Nov 2007
Oct 3rd, 2008
-1

Re: retrieving data from database into jsp page

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
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 871
Code tags enforcer
peter_budo is offline Offline
6,653 posts
since Dec 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: Disabling text-wrapping for f:selectItem tags
Next Thread in JSP Forum Timeline: witch one is better Jboss server or tomcat server





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC