473,388 Members | 1,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

How to pass Javascript Value to a Jsp

14
Hello everybody,
As i get a value from javascript , i am in need of posting that to a jsp codes,
my code snippet is as............



Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <script type="text/javascript" src="gears_init.js"></script>
  3. <script type="text/javascript">
  4. var db = google.gears.factory.create('beta.database');
  5. db.open('database-demo');
  6. var rs = db.execute('select * from ntech');
  7. while (rs.isValidRow()) {
  8. alert(rs.field(0)+" "+rs.field(1));
  9. var name=rs.field(0);
  10. var address= rs.field(1);
  11.   alert(name);
  12.   alert(address);
  13.  
  14.  
  15. <%
  16.    Connection conn = null;
  17.    ResultSet rs = null;
  18.    String result="";
  19.  
  20.    PreparedStatement stmt = null;
  21.  
  22.  
  23.        try {                                     
  24.                        conn = Utilities.getDbConnection();
  25.                     stmt  = conn.prepareStatement("insert into test (name,address) values (rs.field(0),rs.field(1)) "); 
  26.  

her i need to pass the values as rs.filed(0) and (1)

any help will be appreciated highly,
with regards,
Creeds
Jul 7 '08 #1
1 1474
acoder
16,027 Expert Mod 8TB
JavaScript is client-side and JSP is server-side. To pass the JavaScript value, use a form to post the values. You can set the values of hidden form elements. If you need to do this without reloading/unloading the page, use Ajax.
Jul 7 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Nath | last post by:
Please help!? I am new to writing html, javascript, pretty new to MySQL but quite proficient at writing Perl and i'm a quick learner. I am building a database driven website and i am a little...
1
by: colleen1980 | last post by:
Hi: Can any one please tell me that how to i pass the two textbox values in the new page. If i use the form action in the popup window page then the new page is open in the same popup window as i...
4
by: IRC | last post by:
hey, i am pretty new on javascript as well as PHP, Hey, anyone can you help me, how to pass the javascript array value to php page......... i want to retrieve the values which are arrayed on...
5
by: JohnDriver | last post by:
Hi, I am having a form which has a text box and 3 radio buttons. I am using GET method in Ajax to pass the value. I can pass the value of the textbox fine but how to pass the value of radio...
8
by: BigZero | last post by:
Hello, i need to pass some variables or value to javascript from php script. well all i need to pass to value to javascript that is with in same php file the two values r in php i need to pass...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.