Senhores, eu tenho uma tela que possui três combos, e elas são carregadas tendo como parâmetro a combo anterior selecionada, veja :
cboCliente (todos clientes ativos já vem carregados)
cboCircuito (carrega apenas os circuitos do cliente selecionado acima)
cboRepetidora (carrega apenas as repetidoras do cliente selecionado acima)
Aí para isso eu criei uma Servlet, e nela eu passo os parametros necessários.
O problema que ocorre, é que funciona perfeitamente para carregar a cboCircuito, agora quando seleciono um item nesta combo consequentemente deveria carregar a cboRepetidora mas nada ocorre.
Abaixo está um trecho da .jsp e o fonte da Servlet
<label for="Cliente"><strong>*</strong>Cliente<br>
<html:select property="idPj" styleId = "idPj" tabindex="1" style="width: 400px" value='${dto.pj.idPj}' onchange="new Ajax.Updater('selectBoxCircuito', '/controlIp/AjaxServlet?action=circuito&idPj='+ this.value);">
<html:option value="-1">Selecione uma opção</html:option>
<html:options collection="listPjs" property="idPj" labelProperty="nomeFantasia"/>
</html:select>
</label>
<div id="selectBoxCircuito">
<label for="Circuito"><strong>*</strong>Circuito:<br>
<html:select property="idCircuito" styleId = "idCircuito" tabindex="2" style="width: 400px" value='${dto.circuito.idCircuito}' onchange="new Ajax.Updater('selectBoxRepetidora', '/controlIp/AjaxServlet?action=repetidora&idPj=205');">
<html:option value="-1">Selecione uma opção</html:option>
<html:options collection="listCircuitos" property="idCircuito" labelProperty="designacao"/>
</html:select>
</label>
</div>
<div id="selectBoxRepetidora">
<label for="Repetidora"><strong>*</strong>Repetidora:<br>
<html:select property="idPonto" styleId = "idPonto" style="width: 400px" tabindex="3" value='${dto.repetidora.idPonto}'>
<html:option value="-1">Selecione uma opção</html:option>
<html:options collection="listRepetidoras" property="idPonto" labelProperty="descricao"/>
</html:select>
</label>
</div>
package br.com.unitelco.servlet;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import br.com.unitelco.dto.CircuitoDTO;
import br.com.unitelco.dto.RepetidoraDTO;
import br.com.unitelco.exceptions.DAOException;
import br.com.unitelco.utils.ComboUtils;
public class AjaxServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public AjaxServlet() {
super();
}
public void init() throws ServletException {
}
public void destroy() {
super.destroy();
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ComboUtils combo = new ComboUtils();
String action = request.getParameter("action");
response.setCharacterEncoding("ISO-8859-1");
int idPj = 0;
if (request.getParameter("idPj") != null) {
idPj = Integer.parseInt(request.getParameter("idPj"));
}
if ("circuito".equals(action)) {
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/jsp/ajax/circuitoCliente.jsp");
try {
ArrayList<CircuitoDTO> rows = (ArrayList<CircuitoDTO>) combo.Circuitos(request, idPj);
request.setAttribute("listCircuitos", rows);
} catch (DAOException e) {
request.setAttribute("erro", e.getMessage());
}
dispatcher.forward(request, response);
} else if ("repetidora".equals(action)) {
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/jsp/ajax/repetidoraCliente.jsp");
try {
ArrayList<RepetidoraDTO> rows = (ArrayList<RepetidoraDTO>) combo.Repetidoras(request, idPj);
request.setAttribute("listRepetidoras", rows);
} catch (DAOException e) {
request.setAttribute("erro", e.getMessage());
}
dispatcher.forward(request, response);
}
}
}