• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing values in a form with multiple actions

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to JSP/Struts. I really need your help on how to pass values in a form with multiple actions. Please help out.

Here is the sample code.
<html:form action="someAction" method="post">
<table>
<tr>
<td><html:select property="factoryId">
<html ption...>
</td>
</tr>
<tr><td><html:link page="/actions/../actionOne.do"></td></tr>
<tr><td><html:link page="/actions/../actionTwo.do"></td></tr>
</table>
</html:form>

My question: how to pass factoryId to servlet (Struts action)?
Many thanks.
 
Nepean Robert
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I kind of thinking how to pass parameters in html:link tag.
I defined a HashMap first, then pass the params map to the link tag.
<% HashMap params = new HashMap();
params.put( "factoryId", "120" );
request.setAttribute( "params", params );
%>

JSP code,
<html:link page="/actions/../someAction.do" name="params">
</html:link>.

You see I hardcode 120 to the factoryId. factoryId is drop done list, I don't know how to define the factoryId.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to dynamically create a link based on the value in a form element you need to use JavaScript.
 
Enjoy the full beauty of the english language. Embedded in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic