Here is a way to set up a "fake" form that consists of the form element and
hidden inputs all having id attributes with unique values. For example:
<html>
<head>
<script>
// global js vars for this page
var var_hid1, var_hid2;
function setTheVars() {
var_hid1 = "abc";
var_hid2 = "def";
}
function submitTheForm(theAction) {
// set the hidden fields from the global vars
form1.hid1.value = var_hid1;
form1.hid2.value = var_hid2;
// set the form action
form1.action = theAction;
// check it out first
alert(form1.hid1.value);
alert(form1.action);
// just like hitting the submit button in a form
form1.submit();
}
</script>
</head>
<body>
<form id="form1" method="post">
<input type="hidden" id="hid1">
<input type="hidden" id="hid2">
</form>
<a href="javascript:setTheVars();submitTheForm('/servlet/ThisServlet',
var_hid1,var_hid2);">the link</a>
</body>
</html>
>>>>>>>>
----- Original Message -----
From: manav agarwal
To: [EMAIL PROTECTED]
Sent: Thursday, April 26, 2001 2:17 PM
Subject: Re: calling servlet using a link
sorry..i could have made it clearer...the parameter that i pass is a
variable ...which may or may not contain the spaces...how do i make sure the
full variable is passed along..and not just the first word.
>From: Pierre-Yves Saumont
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology."
>To: [EMAIL PROTECTED]
>Subject: Re: calling servlet using a link
>Date: Thu, 26 Apr 2001 22:35:52 +0200
>
>
>
>Pierre-Yves
>
>
>-----Message d'origine-----
>De : A mailing list for discussion about Sun Microsystem's Java Servlet API
>Technology. [mailto:[EMAIL PROTECTED]]De la part de manav
>agarwal
>Envoy� : jeudi 26 avril 2001 21:51
>� : [EMAIL PROTECTED]
>Objet : calling servlet using a link
>
>
>How can i call a servlet using
>but with parameters ..some of which maybe a string(with spaces in between)
>etc..
>
>Can i not use without it being in a
>
>My problem is that i have to call the servlet using a link and not a button
>etc..
>
>thanks in advance,
>
>Manav.
>
>
>
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST". Archives:
>http://archives.java.sun.com/archives/servlet-interest.html Resources:
>http://java.sun.com/products/servlet/external-resources.html LISTSERV Help:
>http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
Get your FREE download of MSN Explorer at http://explorer.msn.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST". Archives:
http://archives.java.sun.com/archives/servlet-interest.html Resources:
http://java.sun.com/products/servlet/external-resources.html LISTSERV Help:
http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html