Home Answers Viewqa JSP-Interview-Questions how to pass form values from javascript of html page to jsp page

 
 


maheshnayak
how to pass form values from javascript of html page to jsp page
0 Answer(s)      2 years and 6 months ago
Posted in : JSP-Interview Questions

This is my sample html page which contains inline javascript which calculates the geocode and tries to return the lattitude and longitude .But my question is how to submit all the form values with lattitude and longitude returned from showlocation funtion to submitform.jsp page and display latitude value in jsp page .

Index.html

    <html>
    <head>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA5yM-fP6TPUheIXxW3TxpVRRgJAR_YXLeqIBw9Qs7Dzlh-4wFexRUVFiN8RbSageQjhAggT3jom"
    type="text/javascript"></script>
<script type="text/javascript"
    src="http://maps.google.com/maps/api/js?sensor=false">
</script>

    <script type="text/javascript">
    geocoder = new GClientGeocoder();
     function showlocation() {
            var clientaddress = document.getElementById('addstreetname').value;
            geocoder.getLocations(clientaddress, function(response) {
                if (!response || response.Status.code != 200) {
                    alert("Sorry, we were unable to geocode the first address");

                }
                else {
                    var lat1 = response.Placemark[0].Point.coordinates[1];
                    var lng1 = response.Placemark[0].Point.coordinates[0];

                    return {latitude: lat1, longitude: lng1};
        }
            });
    </script>
    </head>
    <body>
    <form id="addresslistingform" action="submitform.jsp" onsubmit="returnshowlocation();">
                Company_Name:<br/>
                      <input size="30" type="text" id="businessname" name="businessname"/><br/>
                    Zipcode:<br/>
                      <input size="30" type="text" id="zipcode"  name="zipcode1"/><br/>
                    Street No:<br/>
                      <input size="30" type="text" id="addstreetno" name="streetno"/><br/>
                    Street Name:<br/> 
                      <input size="30" type="text" id="addstreetname"  name="streetname"/><br/>
                    State:<br/>                  
                      <select name="select2" id="select2" class="required" name="state" >
                        <option value="">Select Your State</option>
                        <option value="1"> karnataka</option>
                        <option value="2"> Kerala</option>
                       <option value="3"> Andhra Pradesh</option>
                       </select>
    </form>
    </body>
    </html>

submitform.jsp

<%@ page language="java" import="java.sql.*" %>

     <%
            String driver = "com.mysql.jdbc.Driver";
                Class.forName(driver).newInstance();
            Connection con=null;
            ResultSet rst=null;
            Statement stmt=null;

        try{
            String url = "jdbc:mysql://localhost:3306/";
                String dbName = "db";
                String driverName = "com.mysql.jdbc.Driver";
                String userName = "";
                String password = "";


            con = DriverManager.getConnection(url+dbName, userName, password);
            stmt=con.createStatement();
        }catch(Exception e){
                System.out.println(e.getMessage());
              }


     String Company_Name=request.getParameter("businessname");
     String Zipcode =request.getParameter("zipcode1");
    String Street_Number=request.getParameter("streetno");
    String Street_Name=request.getParameter("streetname");
    String State= request.getParameter("state");    
   String Latitude=request.getParameter("Latitude");
    out.println("latitude is :"+request.getParameter("Latitude"));

          %>
View Answers









Related Pages:
how to pass form values from javascript of html page to jsp page
how to pass form values from javascript of html page to jsp page   This is my sample html page which contains inline javascript which calculates... to submit all the form values with lattitude and longitude returned from
How to pass parametes from JSP page to HTML page? - JSP-Servlet
How to pass parametes from JSP page to HTML page?  Hi all, In my project I have one JSP page and one HTML page. In JSP page I have created HTML... to pass the values from my JSP page to HTML page. Pls help me out. Hitendra 
how to pass values from 2nd page tp 3rd page....
how to pass values from 2nd page tp 3rd page....  Hi, How to pass values from 2nd page to 3rd page..... here are my programs(not exactly correct...; Login1.jsp : In dis , to get the values from Login.jsp,i ve used: <form
Pass values from form to form
Pass values from form to form       Java program to pass values from one form to another form... values from one page to another consecutive page which is being called then we can
How to pass Array of string from action class to jsp page
How to pass Array of string from action class to jsp page  this is my... jsp page is <%-- Document : select_service Created on : Aug 31...="text/html"%> <%@page pageEncoding="UTF-8"%> <%@ taglib uri="http
[JSP] How to pass back ID to previous page.
[JSP] How to pass back ID to previous page.  Hi experts, May I ask something. How to link a page to previous page which the content in previous page is selected from database where IDPRODUCT=". I don't know how to pass back
How to pass the value from controller to jsp page ?
How to pass the value from controller to jsp page ?  HI I need to pass the value from controller to jsp. I use the way like this Controller request.setAttribute("msg", "Successfully Login"); In jsp ${msg} and then i
How to retrieve array values from html form to jsp?
How to retrieve array values from html form to jsp?  Hi! I am... it into jsp. Means i just want to retrieve values from html form containing array... sample code for how to retrive array values from html to jsp.   hi friend
Pass value from JSP to JavaScript
Pass value from JSP to JavaScript       We can also pass the value from a JSP page to the java... script from the HTML page. Since in JSP page we can embed HTML tags as well. 
how to pass input from radio button to jsp page
how to pass input from radio button to jsp page  hi.. the code below here there are list of radio buttons here in jsp page when the values are matched from database. I want to pass the selected value in Struts Action FormBean
how to pass input from radio button to jsp page
how to pass input from radio button to jsp page  hi.. the code below here there are list of radio buttons here in jsp page when the values are matched from database. I want to pass the selected value in Struts Action FormBean
how to pass input from radio button to jsp page
how to pass input from radio button to jsp page  hi.. the code below here there are list of radio buttons here in jsp page when the values are matched from database. I want to pass the selected value in Struts Action FormBean
pass radio button values to next page
pass radio button values to next page  how to pass selected radio button values which coming from mysql database to next page using php. Please show me with examples
passing values form javascript - JSP-Interview Questions
passing values form javascript  please i want to pass values from javascript function to jsp code how can i do
How to pass multiple values from a servlet to JSP?
How to pass multiple values from a servlet to JSP?  hi, I want to pass multiple values form a servlet to JSP. Hw do i do that? I am able to send one value at a time without any prb, but I am unable to carry multiple (from two
Java Pass Value Example
Pass value from JSP to JavaScript We can also pass the value from a JSP page to the java script as we have done in our previous example of passing values to the java script from the HTML page. Since
How To Page Refresh Using JavaScript In JSP
How To Page Refresh Using JavaScript In JSP...; Step 1: Create a web page(sign.jsp) to show a button to Login user. <%@ page import="java.sql.*" %> <!DOCTYPE HTML PUBLIC "
Displaying the values in text fields of a form from a javascript function in jsp
Displaying the values in text fields of a form from a javascript function... to call a javascript function by passing 3 values from applet. And i have to display these values in 3 text fields of a form in the current web page. Here form
Pass parameters from JSP to Servlet
Pass parameters from JSP to Servlet In this section, you will learn how to pass parameters from JSP page to servlet. For this purpose, we have used...: <%@page language="java"%> <% request.setAttribute("Company
how to set values from parent page to iframe in javascript
how to set values from parent page to iframe in javascript  how to set values from parent page to iframe in javascript pls reply me as possible as I am in great trouble
JavaScript navigate to page
; In this section, you will learn how to navigate from one page to another using JavaScript. For this purpose, we have created two html pages navigatePage.html... JavaScript navigate to page
PHP Variables from Page to Page
PHP Variables from Page to Page A PHP programmer can easily pass the variables... it will effect you : Example 2. Sending values from URL through form. login.php... simple html form. In the second page (welcome.php) we used $_SESSION[] function
how to pass string array from action class to jsp page? pls reply me.
how to pass string array from action class to jsp page? pls reply me.  how to pass string array from action class to jsp page? pls reply me.  ...); And through your jsp page, get array values. <% try { String[] str = (String
JSP Value to JavaScript
to pass the value from JSP to JavaScript. The JavaScript create a function that accepts the value from the jsp page.  Understand with Example In this section, we are going to pass the jsp value to javaScript. For this we have create
HTML login page code
the complete HTML JavaScript code for User Login Page. Thanks in Advance!   ...HTML login page code  Hi all, I am writing my first HTML JavaScrip validation page called "UserLogin.html". So, please guide me how to validate user
html login page with ajax
html login page with ajax  hi all... i want to create a login page using html and ajax for validation is must. please help me doing that with code... thanks in advance   Here is a jsp example that accepts username
Example program to pass value from Html to java script
Example program to pass value from Html to java script       We can also pass the values from...() in our example html page it pass it to the java script of the page
Calling a jsp page from Servlet
Calling a jsp page from Servlet  How can I do this? Suppose I have jsp page aaa.jsp. From aaa.jsp on form action I have made a call to a servlet... List and data is being retrieve. Now I want to pass this List to another jsp page
Populate value into HTML page
Populate value into HTML page  Hi, How to populate values from one html page table to another html page..? Thanks
JSP:HTML Form in-place Editing - JSP-Servlet
JSP:HTML Form in-place Editing  I have an HTML form (form #1) which... from a stringquery into another page and having the same form, for some reason... beans. Perhaps you guys are better aware of in-place html form editing than me
Values from servlet into dropdownlist in jsp page using ajax
Values from servlet into dropdownlist in jsp page using ajax  1) jsp...;%@ page language="java" contentType="text/html; charset=ISO-8859-1...); } } } Im not able to get values retrived from
passing textbox value from one page to another page using html n javascript
passing textbox value from one page to another page using html n javascript  on button onclick event pass text box value and i want to pass value... on the othe (next/prevoious)page please help me   1)page1.html: <html>
JSP to add details to a database from a HTML form.
JSP to add details to a database from a HTML form.  Hi I'm a second year CS student who has to use JSP to validate a HTML form and add the details...; <%@ page contentType = "text/html" %> <%@ taglib uri="http
JSP Page Error
JSP Page Error  Hello Sir. I m using Oracle 10g as a database n... i run jsp page on the browser it only shows the code nothing else.. I have...,lname,uname,pass,gender,age,state,address,mno) values('"+fname+"','"+lname
JSP Page Error
JSP Page Error  Hello Sir. I m using Oracle 10g as a database n... i run jsp page on the browser it only shows the code nothing else.. I have...,lname,uname,pass,gender,age,state,address,mno) values('"+fname+"','"+lname
JSP Page Error
JSP Page Error  Hello Sir. I m using Oracle 10g as a database n... i run jsp page on the browser it only shows the code nothing else.. I have...,lname,uname,pass,gender,age,state,address,mno) values('"+fname+"','"+lname
how to give link from jsp to jsp page
how to give link from jsp to jsp page  hi this is my following code... language="java"%> <%@page import="java.sql.*"%> <form method="post" action... file is Modify but here i have to give modifyUser.jsp file but i don't khow how
how to give link from jsp to jsp page
how to give link from jsp to jsp page  hi this is my following code... language="java"%> <%@page import="java.sql.*"%> <form method="post" action... file is Modify but here i have to give modifyUser.jsp file but i don't khow how
Populate values from html to another html
Populate values from html to another html In this tutorial, you will learn how to send values from one html page to another. Here, we have create a html... on another html page. page1.html: <html> <form type=get action="
JSP Login Page Question
JSP Login Page Question  hey..i have a login page where different... and displayed it on the welcome page. Apart from this if user is not registered...("select * from register where username='"+user+"' and password='"+pass
How to fetch entries/values from database to a jsp page one by one?
How to fetch entries/values from database to a jsp page one by one?  I have a table in Microsoft SQL server Management Studio with two columns title and data and each column has 10 enteries. I have a jsp page on which i want
redirecting a login authenticated form to a form to be displayed on the same page from where the login authentication has taken place.
redirecting a login authenticated form to a form to be displayed on the same page from where the login authentication has taken place.  I am...=st.executeQuery("select * from login where username='"+user+"' and password='"+pass+"'"); int
JavaScript XML to HTML
JavaScript XML to HTML    ... to display the XML data into HTML table. As you have already learned how....  Following code gets the values from the XML document and display
problem in sending more than 500 values to a jsp page
problem in sending more than 500 values to a jsp page  when i am trying to send more than 500 values from a html form to a jsp page browser is showing that server is not sending any data...I have configured tomcat5.5
Javascript Examples
which takes another HTML pageJavaScript getElementById select We can...; JavaScript navigate to page In this section, you will learn how to navigate from one page to another using JavaScript. For this purpose, we have created
How to insert data into databse by JSP form registration page in netbeans
How to insert data into databse by JSP form registration page in netbeans  ... of data for login purpose. I have created 1 form in JSP netbeans with both username.... & how to connect tht form to my databse , so it can store data?   1
i want to pass Javascript value to JSP scriptlet..
i want to pass Javascript value to JSP scriptlet..  i am having a problem that, i am having a combo box in the JSP page when i select an item from... now i want to pass this value to JSP scriptlet
how to pass variable from simple java main class(not servlet) to the jsp page?
how to pass variable from simple java main class(not servlet) to the jsp page?  I have a simple Java class in which I invoke a call to a JSP page... from the simple Java class to the JSP page. How can I do that? Here is my
Passing Parameters to Another JSP Page
in the jsp post from the html form or the jsp page.   The code...Passing Parameters to Another JSP Page      By using the include action we can pass the parameters to another jsp page
how to execute the below servlet with html page
how to execute the below servlet with html page  //vallidate user n...,ServletException { res.setContentType("text/html"); PrintWriter out=res.getWriter...=req.getParameter("pwd"); String sql="SELECT * FROM userlogin UNAME=? and PWD

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.