Boa noite pessoal!
Espero que todos estejam bem.
Pessoal, estou desenvolvendo um pequeno sistema de transportadora para entregar na faculdade estou com algumas duvidas.
Eu estou desenvolvendo o sistema utilizando jsp, servlets e jstl, mais nenhuma framework devido exigencia do professor.
Eu não estou conseguindo carregar um valor passado via parametro em um select existente na minha tela…
resumindo…
tenho uma tela que mostra a listagem de veiculos, na qual o chassi do mesmo é um link que quando acionado transfere envia o usuario para tela de edição do veiculo setando os dados do mesmo nos campos do form.
Bom, minha aplicação carrega os dados e tudo mais, exceto nos dois campos select…
minha duvida pessoal é a seguinte:
Como faço para meus selects do form (equelas combos) carreguem o parametro enviado pela pagina de listagem?
Abaixo os códigos das telas:
<!-- tela de listagem de veiculos -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:import url="/cabecalho.jsp" />
<jsp:useBean id="veiculos"
class="br.com.transportesmaster.model.VeiculoMODEL"/>
<form id="formconsultaveiculo" name="formconsultaveiculo" method="post">
<center>
<table>
<tr>
<td colspan="4"
style="background-color: navy; color: white; text-align: center; font-size: medium; font-weight: bold">
Consulta de Veiculos</td>
</tr>
<tr>
<td style="font-size: x-small; color: black">Modelo:</td>
<td><input type="text" style="font-size: x-small;" name="tmodelo"
id="tmodelo"></td>
<td style="font-size: x-small; color: black">Estado Geral:</td>
<td><select style="font-size: x-small; width: 145px"
name="sestadogeral" id="sestadogeral">
<option id="opt_estado_geral0" label="Selecione">Selecione</option>
<option id="opt_estado_geral1" label="Novo">Novo</option>
<option id="opt_estado_geral2" label="Bom">Bom</option>
<option id="opt_estado_geral3" label="Regular">Regular</option>
<option id="opt_estado_geral4" label="Ruim">Ruim</option>
</select></td>
</tr>
<tr>
<td style="font-size: x-small; color: black">Chassi:</td>
<td><input type="text" style="font-size: x-small;" name="tchassi"
id="tchassi"></td>
<td style="font-size: x-small; color: black">Regiao de Entrega:</td>
<td><input type="text" style="font-size: x-small;"
name="tregiaoentrega" id="tregiaoentrega"></td>
</tr>
<tr>
<td style="font-size: x-small; color: black">Placa:</td>
<td><input type="text" style="font-size: x-small;" name="tplaca"
id="tplaca"></td>
<td colspan="2" style="text-align: right"><input type="submit"
style="border-color: darkblue; border-style: ridge; width: 70px;"
value="Pesquisar" id="bpesquisar"> <input type="reset"
style="border-color: darkblue; border-style: ridge; width: 70px;"
value="Limpar" id="blimpar"></td>
</tr>
</table>
</center>
<hr />
<center>
<table>
<tr>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Id</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Chassi</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Marca</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Modelo</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Categoria</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Ano</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Placa</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Estado Geral</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Regiao de Entrega</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Tipo de Mercadoria</td>
<td
style="background-color: navy; color: white; text-align: center; font-size: small; font-weight: bold">
Capacidade de Carga</td>
</tr>
<c:forEach var="veiculo" items="${veiculos.lista}">
<tr>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.id}"/></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:url value="telaedicaoveiculo.jsp" var="editar">
<c:param name="id" value="${veiculo.id}" />
<c:param name="chassi" value="${veiculo.chassi}" />
<c:param name="marca" value="${veiculo.marca}" />
<c:param name="modelo" value="${veiculo.modelo}"/>
<c:param name="categoria" value="${veiculo.categoria}" />
<c:param name="ano" value="${veiculo.ano}" />
<c:param name="placa" value="${veiculo.placa}" />
<c:param name="estado_geral" value="${veiculo.estado_geral}" />
<c:param name="regiao_entrega" value="${veiculo.regiao_entrega}" />
<c:param name="tipo_mercadoria" value="${veiculo.tipo_mercadoria}" />
<c:param name="capacidade" value="${veiculo.capacidade}" />
</c:url>
<a href="${editar}"><c:out value="${veiculo.chassi}"/></a></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.marca}"/></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.modelo}"/></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.categoria}"/></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.ano}"/></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.placa}"></c:out></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.estado_geral}"/></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.regiao_entrega}"/></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.tipo_mercadoria}"/></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:out value="${veiculo.capacidade}"/></td>
<td
style="color: black; text-align: center; font-size: small;">
<c:url value="deletarveiculo.do" var="deletar">
<c:param name="id" value="${veiculo.id}" />
</c:url>
<a href="${deletar}">Deletar</a>
</td>
</tr>
</c:forEach>
</table>
</center>
<center><input type="submit"
style="border-color: darkblue; border-style: ridge; width: 100px;"
value="Novo Veiculo" id="bnovo"></center>
</form>
<c:import url="/rodape.jsp" />
<!-- tela de edição de veiculo -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:import url="/cabecalho.jsp"/>
<center>
<form id="formedicao" name="formedicao" method="post" action="editarveiculo.do">
<table>
<tr>
<td colspan="6" style="background-color: navy; color: white; text-align: center; font-size: medium; font-weight: bold;">
Edicao de Veiculos
</td>
</tr>
<tr>
<td style="font-size: x-small; color: black">Id: </td>
<td><input type="text" readonly="readonly" style="font-size: x-small;" name="tid" id="tid" value="${param.id}"></td>
</tr>
<tr>
<td style="font-size: x-small; color: black">Marca: </td>
<td><input type="text" style="font-size: x-small;" name="tmarca" id="tmarca" value="${param.marca}"></td>
<td style="font-size: x-small; color: black">Modelo: </td>
<td><input type="text" style="font-size: x-small;" name="tmodelo" id="tmodelo" value="${param.modelo}"></td>
<td style="font-size: x-small; color: black">Categoria: </td>
<td><input type="text" style="font-size: x-small;" name="tcategoria" id="tcategoria" value="${param.categoria}"></td>
</tr>
<tr>
<td style="font-size: x-small; color: black">Ano: </td>
<td><input type="text" style="font-size: x-small;" name="tano" id="tano" value="${param.ano}"></td>
<td style="font-size: x-small; color: black">Placa: </td>
<td><input type="text" style="font-size: x-small;" name="tplaca" id="tplaca" value="${param.placa}"></td>
<td style="font-size: x-small; color: black">Chassi: </td>
<td><input type="text" style="font-size: x-small;" name="tchassi" id="tchassi" value="${param.chassi}"></td>
</tr>
<tr>
<td style="font-size: x-small; color: black">Estado geral: </td>
<td>
<select style="font-size: x-small; width: 145px" name="sestadogeral" id="sestadogeral" >
<option id="opt_estado_geral0">Selecione...</option>
<option id="opt_estado_geral1">Novo</option>
<option id="opt_estado_geral2">Bom</option>
<option id="opt_estado_geral3">Regular</option>
<option id="opt_estado_geral4">Ruim</option>
</select>
</td>
<td style="font-size: x-small; color: black">Regiao de Entrega: </td>
<td><input type="text" style="font-size: x-small;" name="tregiaoentrega" id="tregiaoentrega" value="${param.regiao_entrega}"></td>
<td style="font-size: x-small; color: black">Tipo de Mercadoria: </td>
<td>
<select style="font-size: x-small; width: 145px" name="stipomercadoria" id="stipomercadoria">
<option id="opt_tipo_mercadoria0">Selecione...</option>
<option id="opt_tipo_mercadoria1">Alimento Nao Pereciveis"</option>
<option id="opt_tipo_mercadoria2">Alimentos Pereciveis</option>
<option id="opt_tipo_mercadoria3">Eletro-Eletronicos</option>
<option id="opt_tipo_mercadoria4">Moveis</option>
<option id="opt_tipo_mercadoria5">Tecidos</option>
</select>
</td>
</tr>
<tr>
<td style="font-size: x-small; color: black">Capacidade de Carga: </td>
<td><input type="text" style="font-size: x-small;" name="tcapacidadecarga" id="tcapacidadecarga" value="${param.capacidade}"></td>
<td colspan="4" style="text-align: right;">
<input type="submit" style="border-color: darkblue; border-style: ridge; width: 60px;" value="Salvar" id="bsalvar" >
<input type="reset" style="border-color: darkblue; border-style: ridge; width: 60px;" value="Limpar" id="blimpar">
</td>
</tr>
</table>
</form>
</center>
<c:import url="/rodape.jsp"/>
Pessoal, eu agradeço muito quem puder me ajudar.
Vlw!