File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes access a param from HttpRequest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "access a param from HttpRequest" Watch "access a param from HttpRequest" New topic

access a param from HttpRequest

Anil Rayarapu

Joined: Mar 24, 2003
Posts: 3
Hi, I need some help in this one.
How can i access which button is pressed in a actionclass from the Httprequest passed to it?
Chris Smith
Ranch Hand

Joined: May 03, 2002
Posts: 42
If you assign a "name" and "value" attribute to a standard button, the request parameters will include a name/value pair containing that name and value. My preference, since the "value" attribute is also used by the user agent to render the screen, is to ignore it and give buttons unique names; then, check which one is present.
For image buttons, the name will be used, but ".x" and ".y" appended, along with the coordinates of the mouse click. Most of the time, you don't care about those, so just ignore them... but again, use the button's name attribute to identify it. That is, if your HTML says "<input name='test'>", just check the request parameters for a parameter with the name "test.x".
Anil Rayarapu

Joined: Mar 24, 2003
Posts: 3
Thanks Smith.. I was looking where i can find the syntax for the code and the function for calling the value also.
Phil Chuang
Ranch Hand

Joined: Feb 15, 2003
Posts: 251
For reference:
Look around in there, you should find what you're looking for.
[ March 24, 2003: Message edited by: Phil Chuang ]
I agree. Here's the link:
subject: access a param from HttpRequest
It's not a secret anymore!