aspose file tools*
The moose likes JSP and the fly likes want to send a value to a sevlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "want to send a value to a sevlet" Watch "want to send a value to a sevlet" New topic
Author

want to send a value to a sevlet

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
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 ....


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
How are you getting "constvalue"? There must be some mistake in retrieving the value.
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

Did you use &constvalue="<%= value %>" ?


[My Blog]
All roads lead to JavaRanch
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41839
    
  63
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.


Ping & DNS - my free Android networking tools app
Satish Chilukuri
Ranch Hand

Joined: Jun 23, 2005
Posts: 266
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

Joined: Dec 11, 2004
Posts: 13410

That's what method="get" does.
The browser is doing that.
It's not related to JSP.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12783
    
    5
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

Joined: Apr 16, 2005
Posts: 689
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
 
subject: want to send a value to a sevlet