Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   Java (http://www.forosdelweb.com/f45/)
-   -   Struts - Propiedad indexed= true - capturar valores (http://www.forosdelweb.com/f45/struts-propiedad-indexed-true-capturar-valores-565529/)

tripero 12/03/2008 20:06

Struts - Propiedad indexed= true - capturar valores
 
Hola estoy usando struts y tengo el siguiente problema:

Tengo una tabla con 10 filas y por cada fila hay un select con 3 posibles valores, lo que yo necesito es logicamente obtener cada valor del select por cada fila, el tema es que en el action me devuelve un arreglo vacio y no entiendo bien porque.



struts-config.xml

<form-bean name="registrarBoletaForm"
type="org.apache.struts.validator.DynaValidatorFor m">
<form-property name="resultadoFinal" type="java.lang.Integer[]" size="10"/>
</form-bean>



presentarBoleta.jsp

<html:form action="/registrarBoletaUsuarioSubmit" method="post">
<table class="tabla" width="276px">
<tr class="encabezado">
<th>Local</th>
<th>Visitante</th>
<th>Resultado</th>
</tr>

<logic:iterate id="partido" name="partidos">
<tr class="fila">
<bean:define id="visitante" name="partido" property="equipoVisitante"/>
<bean:define id="local" name="partido" property="equipoLocal"/>
<bean:define id="idpartido" name="partido" property="id"/>

<td class="fila"><bean:write name="local" property="nombre"/></td>
<td class="fila"><bean:write name="visitante" property="nombre"/></td>

<td>
<html:select indexed="true" name="partido" property="resultadoFinal" value="1"> <-- estara bien esto

<html:option value="0">Local</html:option>
<html:option value="1">Empate</html:option>
<html:option value="2">Visitante</html:option>
</html:select>
</td>
</tr>
</logic:iterate>

</table>
<br>
<html:submit value="ˇApostar!" styleClass="botonApuesta" />
</html:form>





RegistrarBoletaUsuarioAction




public class RegistrarBoletaUsuarioAction extends Action {

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

DynaActionForm f = (DynaActionForm) form;

Integer[] result = (Integer[]) f.get("resultadoFinal");

<!-- result esta vacio-->



Cualquier sugerencia sera mas que bienvenida porque estoy al limite con el tiempo, gracias



saludos

cris_maco 13/03/2008 11:54

Re: Struts - Propiedad indexed= true - capturar valores
 
Has mirado si se te esta cargando bien en el form??seguramente no.
Y una preguntita, lo de declarar la propiedad dentro del mapeo del bean para que es?es solo por saberlo, no por criticar


La zona horaria es GMT -6. Ahora son las 07:51.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.