You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Randall Svancara <rs...@adaweb.net> on 2005/04/27 19:53:58 UTC

Dynamically generating parameterized links using logic:iterate

First of all, I know this must be a frequently asked question.  In java
server pages, I would do this:

<%
while someiterator.hasNext(){
%>
	<a href="/somepage?param1=<%=String
strVal=(String)someiterator.next()%>">Go</a><br />

<%
}

This seems fairly strait forward.  Using the struts framework and tags,
I am struggling.

<logic:iterate id="result" name="ParcelSearchForm" property="results">
<html:link page="/somepage.do" name="result" scope="page"
paramId="parcel" ><bean:write name="result"
property="parcel"/></html:link><br />
</logic:iterate>

I am not sure what I need to use in order to grab the parcel value from
the form bean.  I know my syntax is wrong.

Can someone please demonstrate the proper way to do this.

Randall

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Dynamically generating parameterized links using logic:iterate

Posted by Michael Jouravlev <jm...@gmail.com>.
I guess, it would something like this:

<logic:iterate id="result" name="ParcelSearchForm" 
               property="results" type="com.acme.ParcelObj">
  <html:link page="/somepage.do" paramId="param1"
             paramName="result" paramProperty="parcel">
    <bean:write name="result" property="parcel"/>
  </html:link>
</logic:iterate> 

where com.acme.ParcelObj is the object type, which is collected within
"results" and which has parcel property.

Michael.

On 4/27/05, Randall Svancara <rs...@adaweb.net> wrote:
> First of all, I know this must be a frequently asked question.  In java
> server pages, I would do this:
> 
> <%
> while someiterator.hasNext(){
> %>
>         <a href="/somepage?param1=<%=String
> strVal=(String)someiterator.next()%>">Go</a><br />
> 
> <%
> }
> 
> This seems fairly strait forward.  Using the struts framework and tags,
> I am struggling.
> 
> <logic:iterate id="result" name="ParcelSearchForm" property="results">
> <html:link page="/somepage.do" name="result" scope="page"
> paramId="parcel" ><bean:write name="result"
> property="parcel"/></html:link><br />
> </logic:iterate>
> 
> I am not sure what I need to use in order to grab the parcel value from
> the form bean.  I know my syntax is wrong.
> 
> Can someone please demonstrate the proper way to do this.
> 
> Randall
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org