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

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 5 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 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 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 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 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 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 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
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
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
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
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
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>
how to get a values from a multipart/form-data - JSP-Servlet
how to get a values from a multipart/form-data  Dear sir , I... ,matter,file field values but not status and from field i am getting null values and also the file is not uploading the content type in other jsp it is showing
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
How to pass javascript variable in Scriplet of JSP?
How to pass javascript variable in Scriplet of JSP?  How can I assign the value of a javascript variable to a variable declared in jsp scriplet? Is it possible
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 "
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
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
how to call servlet from html page at anchor tag ?
how to call servlet from html page at anchor tag ?  I have a very... it is not working properly. I split and merge template. In the header part of my page i use... to other page and at that place i give url of a servlet but in server that url
Pass value of rasio button from jsp page to action class(not conventional problem)
Pass value of rasio button from jsp page to action class(not conventional problem)  Hi, I have a jsp page that has code which goes ike this: <... button) to be deleted On clicking 'delete' button . Hence I need to pass eventId
how to add the calendar to the dynamic rows in html or jsp page - JSP-Servlet
how to add the calendar to the dynamic rows in html or jsp page   Hi Sir, i have 3 columns in my jsp page date of payment,amount recieved,no and i have 2 button in my jsp page ADD and delete button. when i click on add
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
Include Static HTML Page in JSP
Include Static HTML Page in JSP   ... html page in jsp. In JSP, there are two ways to include another web resource. 1...; tag is used to include html page. The following includeStatic.jsp page shows
Sending form data from HTML page to SQLserver 2005 database by calling servlet code
Sending form data from HTML page to SQLserver 2005 database by calling servlet code  Hi sir, I would like to know how to send the form data from html page to database by calling servlet code from html page .   
How to read and display data from a .properties file from a jsp page
How to read and display data from a .properties file from a jsp page  I have a .properties file. I have to create a jsp page such that it reads... = DEDCHGG_PWDP and goes on... I have to create a jsp page to show these data
How to pass an arraylist from servlet to jsp?
How to pass an arraylist from servlet to jsp?  Hello, Can anyone please tell me how to pass an arraylist from servlet to jsp? I have two arraylist one of type String and the other int. How to send both the arraylists from
How to Get The Data from Excel sheet into out jsp page???
How to Get The Data from Excel sheet into out jsp page???  How to Get The Data from excel sheet to out jsp page in webApp
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="
How save,get picture from database in my jsp page?
How save,get picture from database in my jsp page?  How i save picture in db after browsing it,and also how i get it on my other jsp page
how to insert the bulk data into the data base from the table of jsp page to another jsp page
how to insert the bulk data into the data base from the table of jsp page to another jsp page  pls help i'm doing the project called centralized... to get values in array in next jsp page and insert into the row by row Please do
to upload a table from DB to the same html page
to upload a table from DB to the same html page  how to make this booklist table to be opened in the same html page itself using a third frame
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
 

 

 

DMCA.com