Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing values in a form with multiple actions

 
Nepean Robert
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic