Radio buttons values to servlet

Discussion in 'JSP' started by ricardo1977, Jul 31, 2012.

  1. ricardo1977

    ricardo1977 New Member

    Joined:
    Jul 31, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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 i´m 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?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice