• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Post to my servlet through java script

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My Servlet does not receive my form data; therefore temp below is null.


I suppose the problem comes from somewhere in my JSP page:



or here, where i try to submit my data (yes my lat/lng values and name values are valid):



Also, the submit causes my browser to load up the servlet page......i don't want that......I just want the Servlet to handle database updates.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the HTML forum as ths is not a servlet question.

The problem has nothing to do with servlets, or even JavaScript, but with the HTML.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A couple of things. Firstly, loose the all-uppercase in your HTML. It's no longer 1996.

Secondly, your form action should not have the absolute URL. Remove the server part of the URL.

Lastly, your form elements have no names. You must use the name attribute to assign the names to be used when the elements are submitted as a request.
 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear,

It's running as it should now.

I'll loose the caps too.....shame cause i like the way it looks.

Is there anything i can do to stop the browser from switching from my JSP page to the Servlet page.

the submit causes my browser to load up the servlet page......i don't want that......I just want the Servlet to handle database updates.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jite eghagha wrote:I'll loose the caps too.....shame cause i like the way it looks.


It really is up to you, but most people find all uppercase hard to read, and it makes your code look very old-fashioned and dated.

Is there anything i can do to stop the browser from switching from my JSP page to the Servlet page.


That is a completely different question that you should start a new post for in the Servlets forum.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jite eghagha wrote:My Servlet does not receive my form data; therefore temp below is null.


I suppose the problem comes from somewhere in my JSP page:



or here, where i try to submit my data (yes my lat/lng values and name values are valid):



Also, the submit causes my browser to load up the servlet page......i don't want that......I just want the Servlet to handle database updates.



use ajax post simply
Note:- but ajax is not cross browser compatible
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Note:- but ajax is not cross browser compatible


It is if you're using a modern JavaScript library.
 
reply
    Bookmark Topic Watch Topic
  • New Topic