Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing a Form Parameter

 
Sege Stephen
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have two similar forms on a page. They are select boxes,
I know how to pass the options in the select box drop down as
a parameter, but what of if I want to a parameter so that
depending on which of the Select boxes I select a value from,
a parameter is passed. I have two of this forms in my code,
I can select an option from either, and then go to the next page.
But I need to pass a parameter, so that I would know which of
Select boxs I have clicked from, because that would determine
what query is run on the subsquent pages. This parameter can
be attached anywhere, ie with the sumbit buttons, or anywhere
in the form.

All I want is if I select an option from select dropdown 1, a
parameter called box1 is passed, if I select from drowdown 2 ,
a parameter box 2 is passed.

Here is my code



[ December 04, 2007: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sege,
It looks like you're writing your pages with Struts.
Since Struts offers its own solutions to a lot of typical problems, you're probably better off asking in our Struts forum.
I'll move this thread over there for you.
-Ben
 
Sege Stephen
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben, Sorry. Yes I am using struts for my application, I posted it on the JSP forum because I thought my problem had to do with a JSP page. Anyway thanks for letting me know, knowing that will let me get better and quicker answers next time, also it would me less work for you as well.

Beside, I found the solution to my problem, I try to solve it before posting it here, but once I am getting no where, I thought it was better to as.

I solve it by adding a single line to my code

<input type="hidden" name="param_name" value="box1" />
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic