Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

retrieving data in jsp page  RSS feed

 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I want to retrieve data from database in jsp page .I am finding it very difficult so please can you all help me out with the problem.
Here is the structure of my database and i am using ms.access


now i want to display the m_bal for pl,sl,cl in the jsp page for the respective userid who has logged in.
Please help me its very urgent.
thanks in advance.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which connection mechanism you are using? whether you get the Connection from DB...if yes

---------------------------------
use DTO(java bean) with ArrayList
---------------------------------

Hope This Helps
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there no one in this forum who can find a solution for my query.Atleast just guide me to proper place as how to go ahead.
Any help will be highly appreciated.
thanks
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi shiju....cool...people might be busy with their own work,,

i give you some hint ,from my below code you may get some idea...from that you try to develop...

 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am using this for connectivity with database

Here onwards i dont know what to write so that i get the result in my format

Just guide me so that i can find a solution.
thanks in advance.
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help you provided me .the code that you have provided me is joining two tables and retreiving data onto the jsp page with respect to particular primary key,isn't it.if i am wrong please rectify me .
I have to retreive the m_bal with respect to the emp no for each sl,pl,cl onto the jsp page as given above .suppose you have to show the user his leave balance which are pl,sl,cl by retrieving data from the given above table and m_bal is the leave balance of the particular user .there is no primary key defined so there are three rows of 1004,1009 etc for each pl,sl,cl
please find the remedy .
thanks.
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
this is the code what i have written

I have got the rows from the database but if i want to display values of pl=30 ,sl=7 ,cl=7 onto the jsp page, is this the way i should write it as stated in "bold" or else what i am doing is wrong .please correct me if i am making a mistake .
thanks in advance.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shiju nair:

if i want to display values of pl=30 ,sl=7 ,cl=7 onto the jsp page


hi shiju,

you are familiar with EL and JSTL ?

just forward the ArrayList to the particular jsp ... and iterate
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sreesnath,
Actually i am totally confused with this problem,so not able to think anything.can you please provide me with an example which will guide me to the solution.please help me
thanks in advance
 
Rakesh Chaudhary
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii Shiju....this is the way you can do it ....so enjoyyyyyyy.

The following is the code to display values reading it from a database in my case its Mysql..



 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

well, but scriptlet is deprecated in jsp ...

i think if shiju do not aware about jstl and EL then he should know them first(for timing , it is ok )
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please tell me how to forward the arraylist to the jsp.
thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!