This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

want to send a value to a sevlet

 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sending som values of the textfields to a servlet..
and i have two buttons one is save button and the other is edit button in the form.

for this i am using java script for sending the control to appropriate one.

in save method//method saveValues(){

document.BluePrintForm.action="/VisuTestingServices/servlet/com.vlms.vts.grandtest.gre.blueprint.GreBluePrint?fun="save";
}

in edit method//method editValues(){

document.BluePrintForm.action="/VisuTestingServices/servlet/com.vlms.vts.grandtest.gre.blueprint.GreBluePrint?fun="edit";
}

i am able to send the fields but along with this i want to send one intger value(constant). to the servlet..
so what changes need to be done to the url for sending the constant value.


I have tried with this url but not getting the value it shows null value in the console.

document.BluePrintForm.action="/VisuTestingServices/servlet/com.vlms.vts.grandtest.gre.blueprint.GreBluePrint?fun=save&constvalue="+value;




please somebody help me ....
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you getting "constvalue"? There must be some mistake in retrieving the value.
 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am getting the constant value by incrementing i value. like for loop. in the jsp file

so i want to send that value of i to the servlet .
did u get it?
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you use &constvalue="<%= value %>" ?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On an unrelated issue, you're using the invoker servlet, but The Invoker Servlet Is Evil. You might want to address that before you go into production.
 
Satish Chilukuri
Ranch Hand
Posts: 266
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is strange. Appending query string parameters through javascript is working if the request is submitted with HTTP POST. But if the method is GET, all the parameters that were appended are being overwritten by the parameters in the form.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what method="get" does.
The browser is doing that.
It's not related to JSP.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13047
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want a value computed by Javascript to be sent with the form data, write it into a hidden field in the form.
Bill
 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Brogden:
If you want a value computed by Javascript to be sent with the form data, write it into a hidden field in the form.
Bill


You Rock!!!

yes, Mr William You got what i exactly wanted to know and u have given the right solution .
thanx a lot man.,
Yes, I have used hidden field for sending the constant value to the servlet..and i got it...

thanks ...

cinux
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic