这是我的代码:
<display:table name="paginatedList" sort="external" requestURI="/pathToMyAction.do" id="element">
<display:column titleKey="label.element.message">
<c:if test="${readDetails}">
<%
Map paramMap = new HashMap();
paramMap.put("param1", ${element.param1});
paramMap.put("param2", ${element.param2});
request.setAttribute("linkParams", paramMap);
%>
<html:link href="pathToDetails.do" name="linkParams" titleKey="label.element.viewInNewWindow" paramName="element" paramId="id" paramProperty="id" target="_blank">
<html:img page="/images/edit.gif" border="0" align="center" />
</html:link>
</c:if>
</display:column>
但这不起作用,我现在无法粘贴错误消息,但它失败了:
paramMap.put("param1", ${element.param1});
原作是:
<html:link href="pathToMyAction.do" titleKey="label.element.viewInNewWindow" paramName="element" paramId="id" paramProperty="id" target="_blank">
<html:img page="/images/edit.gif" border="0" align="center" />
</html:link>
有了这个,我只得到id
,我试图获得超过1个参数,而且我无法使用。
答案 0 :(得分:0)
这就是我所缺少的:
<bean:define id="myParam1" name="element" property="param1" />
<bean:define id="myParam2" name="element" property="param2" />
最后我的代码是这样的:
<display:table name="paginatedList" sort="external" requestURI="/pathToMyAction.do" id="element">
<display:column titleKey="label.element.message">
<c:if test="${readDetails}">
<bean:define id="myParam1" name="element" property="param1" />
<bean:define id="myParam2" name="element" property="param2" />
<%
Map paramMap = new HashMap();
paramMap.put("param1", myParam1);
paramMap.put("param2", myParam2);
request.setAttribute("linkParams", paramMap);
%>
<html:link action="pathToDetails.do" name="linkParams" titleKey="label.element.viewInNewWindow" target="_blank">
<html:img page="/images/edit.gif" border="0" align="center" />
</html:link>
</c:if>
</display:column>
我希望这有助于遇到类似问题的其他人:)。