I need to print catalogo.id
because I need to get catalogo
object from its id. How can I get it, because I have an iterator? Now I print action?idprodotto=XX&idcatalogo=
jsp
<s:iterator value="catalogo">
<s:iterator value="prodotti">
<tr style="background-color: #99CCFF">
<td><s:property value="id" /></td>
<td><s:property value="descrizione" /></td>
<td><s:property value="prezzo" /></td>
<td><s:property value="nPezziVenduti" /></td>
<td><a
href='<s:url action="cancellaProdottoDaCatalogo.action" >
<s:param name="idprodotto"><s:property value="id"/></s:param>
<s:param name="idcatalogo"><s:property value="catalogo.id"/></s:param></s:url>'>rimuovi
dal catalogo</a></td>
</tr>
</s:iterator>
</s:iterator>
UPDATE
Now, I got id of catalogo
but in the action, I have a NullPointer
error, I think that with [1].id
i pass only string and not object. How can solve this problem?
NEW JSP
<s:iterator value="catalogo">
<s:iterator value="prodotti">
<tr style="background-color: #99CCFF">
<td><s:property value="id" /></td>
<td><s:property value="descrizione" /></td>
<td><s:property value="prezzo" /></td>
<td><s:property value="nPezziVenduti" /></td>
<td><a
href='<s:url action="cancellaProdottoDaCatalogo.action" >
<s:param name="idprodotto"><s:property value="id"/></s:param>
<s:param name="idcatalogo"><s:property value="[1].id"/></s:param></s:url>'>rimuovi
dal catalogo</a></td>
</tr>
</s:iterator>
</s:iterator>
ACTION METHOD
public String cancellaProdottoDaCatalogo(){
System.out.println(catalogo.getDescrizione());
Catalogo tmp = catalogoDAO.getCatalogo(catalogo.getId());
for(Prodotto p:catalogo.getProdotti()){
tmp.rimuoviProdotto(p);
}
catalogoDAO.aggiornaCatalogo(catalogo);
return SUCCESS;
}