943,749 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 12812
  • JSP RSS
Apr 5th, 2006
0

how to access the database within same jsp page

Expand 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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
muthumari is offline Offline
20 posts
since Mar 2006
Apr 5th, 2006
0

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?
Reputation Points: 9
Solved Threads: 0
Newbie Poster
madhav_2k is offline Offline
5 posts
since Apr 2006
Apr 21st, 2006
0

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cpweb is offline Offline
3 posts
since Apr 2006
May 27th, 2007
0

Re: how to access the database within same jsp page

Click to Expand / Collapse  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

Please tell me how to do it in two pages.
I use JSP,PHP and mysql.
Thanks, Looking forward to your reply.'
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sankarssps is offline Offline
2 posts
since May 2007
May 28th, 2007
0

Re: how to access the database within same jsp page

Click to Expand / Collapse  Quote originally posted by sankarssps ...
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.
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 871
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
May 28th, 2007
0

Re: how to access the database within same jsp page

please give me the code for the same
Thank you.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sankarssps is offline Offline
2 posts
since May 2007
May 28th, 2007
0

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...
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 871
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: How to install JDBC Driver for MSSQL ?
Next Thread in JSP Forum Timeline: how to send email using jsp





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC