DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   JSP (http://www.daniweb.com/forums/forum24.html)
-   -   how to access the database within same jsp page (http://www.daniweb.com/forums/thread42696.html)

muthumari Apr 5th, 2006 8:30 am
how to access the database within same jsp page
 
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

madhav_2k Apr 5th, 2006 5:22 pm
Re: how to access the database within same jsp page
 
Quote:

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?

cpweb Apr 21st, 2006 2:21 am
Re: how to access the database within same jsp page
 
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.

sankarssps May 27th, 2007 10:55 pm
Re: how to access the database within same jsp page
 
Quote:

Originally Posted by muthumari (Post 203560)
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.'

peter_budo May 28th, 2007 6:48 am
Re: how to access the database within same jsp page
 
Quote:

Originally Posted by sankarssps (Post 374652)
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...

sankarssps May 28th, 2007 1:06 pm
Re: how to access the database within same jsp page
 
please give me the code for the same
Thank you.

peter_budo May 28th, 2007 1:20 pm
Re: how to access the database within same jsp page
 
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...


All times are GMT -4. The time now is 12:19 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC