permaculture playing cards*
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
Author

access a param from HttpRequest

Anil Rayarapu
Greenhorn

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".
HTH
Anil Rayarapu
Greenhorn

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:
http://java.sun.com/products/servlet/2.3/javadoc/index.html
Look around in there, you should find what you're looking for.
[ March 24, 2003: Message edited by: Phil Chuang ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: access a param from HttpRequest