Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


maheshnayak
how to pass form values from javascript of html page to jsp page
0 Answer(s)      3 years and 11 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"));

          %>

Advertisement
View Answers

Related Tutorials/Questions & Answers:
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 
Advertisements
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
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
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
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 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
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 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
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
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. 
[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 redirect from a HTML page?
How to redirect from a HTML page?  Hi, Is it possible to redirect from HTML page to another page on the net? I have one page and I want to redirect... to redirect to another page using HTML code. You can use the following code: <meta
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
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
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
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
Hi how to transfer table data from html page to excel sheet by using javascript .
Hi how to transfer table data from html page to excel sheet by using javascript .  html page to excel sheet by using javascript and i dont want to transfer all rows in table, i want to hide some rows in excel sheet. Please send
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
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
how to pass the mutiple values from    I am getting the error when passing the values from this way emp2=${employee.lastName1} & name=${employee.firstName.How to pass the values from hyperlink in column
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
how to pass the mutiple values from      Hi Friend, Please post your full code. Thanks
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 create a slider on jsp page n slider has values from 0-4
how to create a slider on jsp page n slider has values from 0-4  i want to create a slider on jsp page and slider has values from 0-4   Using the jquery, you can create a slider in jsp. <html> <head> <
Search page form in jsp
Search page form in jsp  search form in jsp   Please go through the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets/search.shtml
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
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>
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
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
Advertisements
 

 

 

DMCA.com