User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 402,665 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,260 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 6771 | Replies: 6
Reply
Join Date: Mar 2006
Posts: 20
Reputation: muthumari is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
muthumari muthumari is offline Offline
Newbie Poster

how to access the database within same jsp page

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2006
Posts: 5
Reputation: madhav_2k is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
madhav_2k madhav_2k is offline Offline
Newbie Poster

Re: how to access the database within same jsp page

  #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  
Join Date: Apr 2006
Posts: 3
Reputation: cpweb is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cpweb cpweb is offline Offline
Newbie Poster

Re: how to access the database within same jsp page

  #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  
Join Date: May 2007
Posts: 2
Reputation: sankarssps is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sankarssps sankarssps is offline Offline
Newbie Poster

Question Re: how to access the database within same jsp page

  #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  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,230
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 10
Solved Threads: 270
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

  #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 5:48 am.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: May 2007
Posts: 2
Reputation: sankarssps is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sankarssps sankarssps is offline Offline
Newbie Poster

News Re: how to access the database within same jsp page

  #6  
May 28th, 2007
please give me the code for the same
Thank you.
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,230
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 10
Solved Threads: 270
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

  #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)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 4:05 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC