• Post Reply Bookmark Topic Watch Topic
  • New Topic

it is for retriving data from database

 
bhagya raavi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cood afternoon sir
i stored student information with fields sid,sname,fname,address,age in mysql databae.
if i give the sid of a student
it has to check whether it present or not in the database,if so it has to give that student information.
please help me how write this condition in a jsp
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by bhagya raavi:
cood afternoon sir
i stored student information with fields sid,sname,fname,address,age in mysql databae.
if i give the sid of a student
it has to check whether it present or not in the database,if so it has to give that student information.
please help me how write this condition in a jsp


We believe in self help here , so just a couple of hints:

1.) Read up on how to use the sql package and/or sql tag libraries in JSP (plenty of tutorials and code samples out there, just Google it).

2.) Read up on how to take the result of that query and put it into a bean that your page can use (again plenty of tutorials out there).

Cheers,
Martijn
 
bhagya raavi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Martijn Verburg:


We believe in self help here , so just a couple of hints:

1.) Read up on how to use the sql package and/or sql tag libraries in JSP (plenty of tutorials and code samples out there, just Google it).

2.) Read up on how to take the result of that query and put it into a bean that your page can use (again plenty of tutorials out there).

Cheers,
Martijn
thankyou sir
 
cj jayamaha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can either execute two mysql statements, first to see if the student with the sid is present in the database and then to retrieve the student.

Or
execute the statement to retrieve the student and set a data member to null if the student is not present on the database...

Do you have a Student class?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!