<script type="text/javascript">
function submitForm(){
...
productArray = new Array(forms[0].elements['productList']); <--- this is NOT working. I'm getting a non-valid value (see attached screenshot, which contains the value displayed by alert function below) alert (productArray);
...
}
</script>
<html:hidden property="'productList'" />
Form Bean:
public class ProductForm extends ActionForm {
private String[]productList;
public void setProductList(String[] productList) {
this.productList= productList;
}
public String[] getProductList() {
return productList;
}
...
}
Well, at a first glance, it looks like this code of yours won't work. You'll have to initialize your JavaScript array by iterating over your list (using the Struts' appropriate tags) and printing the values in each position of the JavaScript array.