• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Advance Java Indexed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 getting null value for productType, is someting wrong ? Please Help me.

Thanks
Vijay
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your html source, what the names that are generated for the checkbox fields? I think you need to use nested:iterate and nested:checkbox.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic