• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

html:link passing multiple parameters

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a situation where I need to pass several parameters in an html:link tag. After reading the documentation, I know that I must use a HashMap to send as a param which would contain the values I want to send to URL. I first display the values in a table using logic:iterate and an arrayList onto the screen. The user should then be able to select a row and send that row's parameters to an action class that produces a pdf.

My problem is how to extract the values from bean:write properties and load them into a hashMap. What would be the correct syntax to do this something like this? I've tried several ways to do something like the following without any luck :

<% String docNumber = <bean:write name="task" property="documentNumber"/> ; %>

Here is a portion of the jsp that I am working with:

<logic:iterate id="task" name="productionQcForm" property="documents" >
<td class="data"><bean:write name="task" property="docGid"/> </td>
<td class="data"><bean:write name="task" property="revision"/> </td>
<td class="data"><bean:write name="task" property="pgCount"/> </td>
<td class="data"><bean:write name="task" property="statDate"/> </td>
<td class="data"><bean:write name="task" property="itemVkey"/> </td>
<td class="data"><bean:write name="task" property="title"/> </td>
<td class="data"><bean:write name="task" property="autoReject"/> </td>
<html:hidden name="task" property="altGid" />
<html:hidden name="task" property="supplement" />
<html:hidden name="task" property="chgType" />
<html:hidden name="task" property="society" />
<html:hidden name="task" property="documentNumber" >
<html:hidden name="task" property="order" />
<%
java.util.HashMap myMap = new java.util.HashMap();

myMap.put("docGid", "How do I get the value of the property "docGid from the list above???");
myMap.put ("docNumber", documentNumber);
myMap.put ("order", order);
myMap.put ("society", "society");
myMap.put ("statDate", "statDate");
myMap.put ("vKey", "itemVkey");
myMap.put ("supp", "supplemenat");
myMap.put ("chgType", "chgType");
myMap.put ("revision", "revision");
pageContext.setAttribute("map", myMap);

%>
<td class="data" align="center">
<html:link page="/showScannerPdf.do" name="map" >
<html:img src="images/EditBCard.gif" altKey="action.properties"
width="20" height="20" border="0"/>
</html:link>
</td>

Any ideas or suggestions would be more than welcome!!
Thanks for you help!

Peggy
 
tumbleweed and gunslinger
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I usually do not have any scriplets in JSP, so all of the java you have in the JSP should be done in the servlet's action and populated into the form bean, including the Map.
You'd create a method that would return the Map and it's values as part of the FormBean. I typically use something like getLink() or getKey(), depending on the situation.
Here is some sample code:
FORM BEAN:

JSP
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic