You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Shriyan Sanmuganathan <ss...@asdyn.com> on 2003/06/11 19:14:17 UTC
Iterator tag and capuring selected values
<select name="productid" class="inputtext" >
I need a help from someone who know struts well. The question is how do
I do this first part using struts.
If I do a regular JSP for selects I do this way,
<select name="productid" class="inputtext" >
<option value="-1">Select a product</option>
<% QueryBean.setSQLStatement(" SELECT product_id,product FROM
products_tb ORDER BY product ");
if(QueryBean.getRecord())
{
while(QueryBean.getNextRecord())
{
String sel="";
if( request.getParameter("productid")!=null &&
request.getParameter("productid").equals(QueryBean.getColumn("product_id
")) )
sel="SELECTED";
%>
<option
value="<%=QueryBean.getColumn("product_id")%>"<%=sel%>><%=QueryBean.getC
olumn("product")%></option>
<%}
}
QueryBean.cleanup();
%>
</select>
What I want to know is when I use struts iterate tag how do I capture
the request and do like above for selected values
<select name="productid" class="inputtext" >
<logic:iterate id="pId" name="ProductBean" property="productList">
<OPTION VALUE="<bean:write name=" pId "
property="productId" />" ><bean:write name=" pId "
property="productName" />
</logic:iterate>
</select>
Thanks
Shriyan
*********