Fala pessoal, blz?
Então, estou aprendendo o JSP na faculdade e estou com uma dúvida…preciso de um filtro de busca de veiculo mais refinado, por exemplo, buscar pelo nome, placa e etc.
abaixo o código que possuo:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="model.Veiculo"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<html>
<style type="text/css">
label {
font-family: arial, helvetica, sans-serif;
font-size: 13;
}
input {
font-style: normal;
font-family: sans-serif;
border-style: solid;
}
.tableDados {
table-layout: auto;
border-collapse: collapse;
border-color: aqua;
border-width: 0;
border-style: dashed;
font-size: 12;
font-style: normal;
font-family: sans-serif;
width: 800px;
}
.tdDados {
border-color: silver;
border-width: 1;
border-style: solid;
empty-cells: show;
}
.trHeader{
border-color: silver;
background-color: orange;
border-width: 1;
border-style: solid;
}
button {
border-style: solid;
border-color: orange;
font-style: normal;
}
</style>
<script language="JavaScript">
function executar(form,operacao){
form.operacao.value = operacao;
form.submit();
}
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Consultar veiculos</title>
</head>
<body>
<form action="ManterVeiculo" method="POST">
<input type="hidden" name="operacao" value="consultar">
<table>
<tbody>
<tr>
<td><label>Nome</label></td>
<td><input type="text" maxlength="30" size="30" tabindex="0" name="nome"></td>
</tr>
<tr>
<td colspan="2">
<INPUT TYPE="submit" NAME="pesquisar" Value="Pesquisar" >
<button type="reset" name="limpar">Limpar</button>
</td>
</tr>
</tbody>
</table>
<table class="tableDados">
<tr align="center" class="trHeader">
<td width="10px" class="tdDados"> </td>
<td width="20px" class="tdDados">ID</td>
<td width="20px" class="tdDados">Nome</td>
<td width="20px" class="tdDados">Placa</td>
<td width="20px" class="tdDados">Chassi</td>
<td width="20px" class="tdDados">Modelo</td>
</tr>
<%
List retorno = (ArrayList)request.getSession().getAttribute("listaVeiculos");
for(Iterator<Veiculo> it = retorno.iterator(); it.hasNext(); ) {
Veiculo c = (Veiculo)it.next();
%>
<tr align="center">
<td width="10px" class="tdDados">
<input type="radio" name="item"
checked="checked"
value="<%=c.getIdVeiculo()%>"></td>
<td width="20px" class="tdDados"><%=c.getIdVeiculo()%></td>
<td width="20px" class="tdDados"><%=c.getNome()%></td>
<td width="20px" class="tdDados"><%=c.getPlaca()%></td>
<td width="20px" class="tdDados"><%=c.getChassi()%></td>
<td width="20px" class="tdDados"><%=c.getModelo()%></td>
</tr>
<%
}
%>
<tr>
<td colspan="13">
<INPUT TYPE="button" NAME="incluir" Value="Incluir"
onclick="executar(this.form,'incluir')">
<INPUT TYPE="button" NAME="alterar" Value="Alterar"
onclick="executar(this.form,'alterar')">
</td>
</tr>
</table>
</form>
</body>
</html>
Alguem saberia me explicar qual mecanismo devo usar para que isso seja possivel?
Abs,