How to pass different request Parameters

Hi Guys, I have different buttons in my HTML page which calls different JSP's. How can I pass the request parameters with these submit button so that my intermediate servlet knows which JSP is requested. It would be great if somebody could tell me how can my servlet know which button was pressed in my HTML page. Thanks Neha

I'm not sure if I understand what you're asking, but it sounds as if you've got a servlet that responds to requests with some HTML, and in that HTML you have some FORMs that list as their actions different JSP pages. If that is the case, then your servlet is not involved in the processing of those JSP pages, and will not know anything about them. As to how you can pass parameters, well in the ACTION="..." section of your form tags, you can do ACTION="myPage.jsp?param1=value1&param2=value2". But for some reason I don't think that's what you're asking. I think you might want to read into a pattern called Front Controller. You can find information about it at Sun's Java Center.

I want the request.parameter value different from what the Button dispalys.

I don't believe this is possible. I checked the HTML 4.01 specification.

That Sucks I guess there is a W3C group working to change that.

-Shashank<BR>MS(CS),BS(CS),SCJP2

Neha Sharma

Ranch Hand

Posts: 126

posted 16 years ago

That's really amazing, something like this not possible, How about if I want to put a .gif image on the button. Neha

shashank shah

Ranch Hand

Posts: 69

posted 16 years ago

Originally posted by Neha Sharma: How about if I want to put a .gif image on the button. Neha

I think that is possible with beans or activex. not sure of exact details though. Worth looking at Object and EMBD tags. Shashank

-Shashank<BR>MS(CS),BS(CS),SCJP2

Dave Soto

Ranch Hand

Posts: 55

posted 16 years ago

There is typically no need to have a different value passed than what is displayed on the button... Here's why: If you have three buttons, and you want them to displayReply Reply with Quote New Thread then just set them up like this:

Then, you just test for those values in your servlet, instead of testing for jsp1, jsp2, and jsp3. Good luck! P.S. In light of this, you may want to withhold your flames to the W3C (at least for now). [This message has been edited by Dave Soto (edited September 25, 2001).]