Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   Radio buttons values to servlet (http://www.go4expert.com/forums/radio-buttons-values-servlet-t28815/)

ricardo1977 31Jul2012 14:11

Radio buttons values to servlet
 
Hello all,

I'm trying to submit registration selection for a servlet through radio buttons.
The idea is that the application admin can insert a payment or block an account.
The selection can be made by selecting one and just one radio button.
After that a servlet should receive the values of that selection (is is to register payment id goes as id if is to block id goes as id*-1).
the problem is that im not getting any value on the servlet.
Here goes the part of my code:
jsp
Code:

...
 <%for (int i = 0;i<registos.size();i++ ) { %>
                    <% Registo reg  = registos.get(i);
                    if(reg.getStatus()==-1){%>
                        <tr>
                            <td width ="8%"></td>
                            <td width ="30%" style="border:1px solid #58ACFA;"><font size ="2" color="#58ACFA"><center><%= reg.getNifEmpresa()%></center></font></td>
                            <td width ="24%" style="border:1px solid #58ACFA;"><font size ="2" color="#58ACFA"><center><%= reg.getDataLimitePagamento()%></center></font></td>
                            <td width ="10%" style="border:1px solid #58ACFA;"><font size ="2" color="#58ACFA"><center><%= reg.getValor()%></center></font></td>
                            <td width ="10%">
                                <font size ="3" color="#58ACFA"><center><div align ="center"><input type="radio" name ="regAtrasados<%= String.valueOf(totRegA) %>"  value="<%= (reg.getId()* (-1)) %>" /></div></center></font>
                            </td>
                            <td width ="10%">
                                <font size ="3" color="#58ACFA"><center><div align ="center"><input type="radio" name ="regAtrasados<%= String.valueOf(totRegA) %>"  value="<%=reg.getId() %>" /></div></center></font>
                            </td>
                            <td width ="8%"></td>
                        </tr>
                                <%totRegA++;}}%>
...

servlet:
Code:

...
 if(tamanhoRegAtrasados>0) {
              for(int i = 0;i<tamanhoRegAtrasados;i++) {
                  String param = "regAtrasados" + String.valueOf(i);
                  nifR = nifR + param +"\t";
                  String[] listaRegistosAtrasados =  request.getParameterValues(param);
                  if(listaRegistosAtrasados!=null) {
                      cc += listaRegistosAtrasados.length;
                  }
                  else {
                      cc+=tamanhoRegAtrasados;
                  }
              }
          }
...

Can anyone help me?


All times are GMT +5.5. The time now is 17:40.