From: Marc P. <ma...@an...> - 2003-06-17 07:52:47
|
On Mon, 16 Jun 2003 17:19:04 -0500, gang wu <gan...@ho...> wrote: > Hi, > > I have a question on passing parameter from HTML to servlet. The > situation is: Hi Gang Wu, This is really a question for the webmacro-user list. This is the list for people who are activel working on the WebMacro code (developers). > 1. I can pass a ArrayList from servlet to HTML which is called > company_list. > > 2. When HTML displayed it dynamically created a table with several > buttons in it: > > <table> > #foreach $entry in $company_list > { > <tr> > <td>$entry.field1</td> > <td>$entry.field2</td> > <td>$entry.field3</td> > <td><input type=submit name="???" value=Select></td> > </tr> > } > </table> > > 3. What I want to do next is: click any one of those buttons to invoke > next HTML page. In between servlet need to know which button was clicked > and get the information (field1 for example). > > Could someone show me a few lines of servlet code on how to do it? I'm afraid it's not that simple. In this kind of scenario you need to generate unique field names based on your data / field number i.e. <input name="field3_submit">. Then your servlet parses all the request parameters to see which one has a value. That's one way of doing it anyway. Best wishes, Marc -- Marc Palmer Contract Java Consultant/Developer http://www.anyware.co.uk/marc/ http://www.wangjammers.org |