If you've got an action that fronts the JSP, use something like:

request.setAttribute("paramMap", PropertyUtils.describe(form));

to dump a map of all the form properties into request scope. Then, in the JSP:

<html:link action="/search" name="paramMap">
  ...
</html:link>

For an all-JSP solution, I guess you could do:

<%@ page import="org.apache.commons.beanutils.PropertyUtils" %>
<jsp:useBean id="paramMap" class="java.util.HashMap"/>
<c_rt:forEach var="entry" items="<%= PropertyUtils.describe(form) %>">
  <c:set target="paramMap" property="${entry.key}" value="${entry.value}"/>
</c_rt:forEach>
<html:link action="/search" name="paramMap">
  ...
</html:link>

Quoting Eric Jain <[EMAIL PROTECTED]>:

> How does one build simple html links that contain all parameters from a
> form?
> 
> There is of course the brute force method:
> 
>   <c:url value="/search" var="url">
>     <c:param name="x" value="${form.x}"/>
>     <c:param name="y" value="${form.y}"/>
>     ...
>   </c:url>
> 
> I assume there is a better way, something along the lines of
> 
>   <html:link action="/search" property="form"/>
> 
> Any ideas?
> 
> 
> --
> Eric Jain

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to