how to access the database within same jsp page

Reply

Join Date: Mar 2006
Posts: 20
Reputation: muthumari is an unknown quantity at this point 
Solved Threads: 0
muthumari muthumari is offline Offline
Newbie Poster

how to access the database within same jsp page

 
0
  #1
Apr 5th, 2006
Hi ,
i have some elements in one form(sample.jsp).I want to insert that fields into database.But i know abt, the insertion of form values in to the database using next page(next page contains database connection) .But i don't know how do write the database connection within the same page(sample.jsp).

Anyone can you help me
Thank you
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5
Reputation: madhav_2k is an unknown quantity at this point 
Solved Threads: 0
madhav_2k madhav_2k is offline Offline
Newbie Poster

Re: how to access the database within same jsp page

 
0
  #2
Apr 5th, 2006
Originally Posted by muthumari
Hi ,
i have some elements in one form(sample.jsp).I want to insert that fields into database.But i know abt, the insertion of form values in to the database using next page(next page contains database connection) .But i don't know how do write the database connection within the same page(sample.jsp).

Anyone can you help me
Thank you
You could use Javascript to get a connection to the database. Wil that work for you?
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 3
Reputation: cpweb is an unknown quantity at this point 
Solved Threads: 0
cpweb cpweb is offline Offline
Newbie Poster

Re: how to access the database within same jsp page

 
0
  #3
Apr 21st, 2006
you could also break the page into two pages.Basically, you could have the page call itself. Like if you wanted to insert username and password into your database, you could do this (this is just sample code)if (theQueryNotComplete){ Do the code for the 1st logical page. With the two elements on them.}else{ And have the info past to the database. now process info and place output.}Now in the if part, place a form/anchor that will point to the same page, this way the info is past to the current page, and it seems as if the page has gone to another, however it really stays on the same page.Even with this it may not seem as practical as above because it will still load, the other alternative is learning AJAX.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 2
Reputation: sankarssps is an unknown quantity at this point 
Solved Threads: 0
sankarssps sankarssps is offline Offline
Newbie Poster

Re: how to access the database within same jsp page

 
0
  #4
May 27th, 2007
Originally Posted by muthumari View Post
Hi ,
i have some elements in one form(sample.jsp).I want to insert that fields into database.But i know abt, the insertion of form values in to the database using next page(next page contains database connection) .But i don't know how do write the database connection within the same page(sample.jsp).

Anyone can you help me
Thank you

Please tell me how to do it in two pages.
I use JSP,PHP and mysql.
Thanks, Looking forward to your reply.'
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,223
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: 489
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: how to access the database within same jsp page

 
0
  #5
May 28th, 2007
Originally Posted by sankarssps View Post
Please tell me how to do it in two pages.
I use JSP,PHP and mysql.
Thanks, Looking forward to your reply.'
If you know JSP as you claim to know, then you would know there are servlets that are design to set connection with database and they are also able to store data in sessions. These data can be then easly retrived in JSP from session.

PS: Solution to original post is useless...
Last edited by peter_budo; May 28th, 2007 at 6:48 am.
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: May 2007
Posts: 2
Reputation: sankarssps is an unknown quantity at this point 
Solved Threads: 0
sankarssps sankarssps is offline Offline
Newbie Poster

Re: how to access the database within same jsp page

 
0
  #6
May 28th, 2007
please give me the code for the same
Thank you.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,223
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: 489
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: how to access the database within same jsp page

 
0
  #7
May 28th, 2007
please find a book to learn that or can start reading following topics
http://java.sun.com/docs/books/tutor...iew/index.html
http://javaboutique.internet.com/tutorials/JSP/
and you can search on google for more

Do not expect that somebody will give you code without any input from you...
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 is more than three months old.
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