File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes sending request parameter on click of button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "sending request parameter on click of button" Watch "sending request parameter on click of button" New topic
Author

sending request parameter on click of button

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Sending request parameter on click of link is easy, like this way:



Here, we can get key1 and key2 at second.jsp from request paramaeters.

But how to send request parameter on click of button??

Hope my question is clear.

Please suggest me..

Thanks a lot.
[ December 24, 2005: Message edited by: Bear Bibeault ]
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
This is really an (X)HTML question. I assume the button you refer to is like a 'submit' button on a form. In which case, you must first create the HTML form (or XForms if you are using a browser which supports that). You can either add parameters which have fixed values, or form controls which accept user input and produce parameters.

For example:



This creates a button with label 'buttonname' which submits the form (sends a new request to the server) containing the fixed (predetermined) parameters 'key1' and 'key2'.

You can also get user input, for example from a text field:



Now a single-line text field will appear; the string entered will be the value submitted to second.jsp for the parameter with name 'key1'.

You could also choose the form method of GET (rather than POST), if you want the parameters to appear in the user's URL (for bookmarking purposes for instance).

If that doesn't help, or doesn't answer your question, please post a more specific question and I'll take another look.
[ December 24, 2005: Message edited by: Charles Lyons ]

Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sending request parameter on click of button