aspose file tools*
The moose likes Struts and the fly likes Struts Indexed html:checkebox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Indexed html:checkebox" Watch "Struts Indexed html:checkebox" New topic
Author

Struts Indexed html:checkebox

Vijay Aneraye
Greenhorn

Joined: Sep 03, 2008
Posts: 8
Hello All,
I have my jsp with indexed of checked box,

<logic:iterate id="productVO" name="subscriptionForm" property="productsList">
<html:checkbox property="productId" name="productVO" ></html:checkbox>
</logic:iterate>

This is my Form Bean.
public class SubscriptionForm extends ActionForm
{

private ProductsType[] productsList;

/**
* @return Returns the productsList.
*/
public ProductsType[] getProductsList() {
return productsList;
}

/**
* @param productsList The productsList to set.
*/
public void setProductsList(ProductsType[] productsList) {
this.productsList = productsList;
}
}

And this is
public class ProductsType
{
private int productId;

/**
* @return Returns the productId.
*/
public int getProductId()
{
return productId;
}
/**
* @param productId The productId to set.
*/
public void setProductId(int productId)
{
this.productId = productId;
}
}
After submitting the form I want the all the selected productIds in to action, so I have written the core in Action of submit
ProductsType[] productType=subscriptionForm.getProductsList();
if(productType!=null){
for(int i=0;i<productType.length;i++){
ProductsType proType=productType[i];
System.out.println(proType.isSelected());
}


}

SO every time I am geeting null value for productType, is someting wrong? Please Help me.

Thanks
Vijay
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Indexed html:checkebox