• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Post to my servlet through java script

 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
amrish sharma
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note:- but ajax is not cross browser compatible

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