matheusPJ 22 de jun. de 2005
nadoPJ 22 de jun. de 2005
Vamos lá!
O servlet que busca as informações.
esponse.setContentType("text/html");
String cpf=request.getParameter("cpf");
String query="select * from cliente where clCPF='"+cpf+"'";
ResultSet rs=null;
rs=Conectar.getResultSet(query);
rs.next();
BeanCliente cli = new BeanCliente();
cli.setCodigo(rs.getString("clCodigo"));
cli.setNome(rs.getString("clNome")); cli.setDataNascimento(rs.getString("clDataNascimento"));
cli.setCNH(rs.getString("clCNH")); cli.setCPF(rs.getString("clCPF")); cli.setEndereco(rs.getString("clEndereco"));
cli.setCidade(rs.getString("clCidade")); cli.setBairro(rs.getString("clBairro")); cli.setCEP(rs.getString("clCEP"));
cli.setEstado(rs.getString("clEstado")); cli.setEmail(rs.getString("clEmail")); cli.setTelefone(rs.getString("clTelefone"));
HttpSession session = request.getSession(true);
session.setAttribute("cli", cli);
RequestDispatcher rd=request.getRequestDispatcher("/exibePesquisa.jsp");
rd.forward(request, response);
//response.sendRedirect("/exibePesquisa.jsp");
}
O JSP que exibe a pesquisa
& lt ; form action = ' http & # 58 ; //localhost:8084/locadora/ControleCliente' method=POST>
& lt ; br & gt ;
& lt ; table width = "93%" border = "0" cellpadding = "0" cellspacing = "1" & gt ;
& lt ; tr & gt ; & lt ; jsp & # 58 ; getProperty name = "cli" property = "codigo" /& gt ;
& lt ; td width = "20%" align = "center" class = "fonteAzul" & gt ; Cliente & # 58 ; & lt ; / td & gt ;
& lt ; td & gt ; & lt ; input name = "nome" type = "text" value = & lt ; jsp & # 58 ; getProperty name = "cli" property = "nome" /& gt ; size = "50" & gt ; & lt ; / td & gt ;
& lt ; / tr & gt ;
& lt ; tr & gt ;
& lt ; td width = "20%" align = "center" class = "fonteAzul" & gt ; Data de Nascimento & # 58 ; & lt ; / td & gt ;
& lt ; td & gt ; & lt ; input name = "data_nascimento" type = "text" value = & lt ; jsp & # 58 ; getProperty name = "cli" property = "dataNascimento" /& gt ; size = "10" & gt ;
& lt ; / td & gt ;
& lt ; / tr & gt ;
& lt ; tr & gt ;
& lt ; td width = "20%" align = "center" class = "fonteAzul" & gt ; CNH & # 58 ; & lt ; / td & gt ;
& lt ; td & gt ; & lt ; input name = "cnh" type = "text" value = & lt ; jsp & # 58 ; getProperty name = "cli" property = "CNH" /& gt ; size = "50""></td>
</tr>
<tr>
<td width=" 20 % " align=" center " class=" fonteAzul ">CPF:</td>
<td ><input name=" cpf " type=" text " value=<jsp:getProperty name=" cli " property=" CPF "/> size=" 16 "></td>
</tr>
<tr>
<td width=" 20 % " align=" center " class=" fonteAzul ">Endere&ccedil;o:</td>
<td ><input name=" endereco " type=" text " value=<jsp:getProperty name=" cli " property=" endereco "/> size=" 50 "></td>
</tr>
<tr>
<td width=" 20 % " align=" center " class=" fonteAzul ">Cidade:</td>
<td><input name=" cidade " type=" text " value=<jsp:getProperty name=" cli " property=" cidade "/> size=" 50 "></td>
</tr>
<tr>
<td width=" 20 % " align=" center " class=" fonteAzul ">Bairro:</td>
<td ><input name=" bairro " type=" text " value=<jsp:getProperty name=" cli " property=" bairro "/> size=" 50 "></td>
</tr>
<tr>
<td width=" 20 % " align=" center " class=" fonteAzul ">Cep:</td>
<td><input name=" cep " type=" text " value=<jsp:getProperty name=" cli " property=" CEP "/> size=" 10 "></td>
</tr>
<tr>
<td width=" 20 % " align=" center " class=" fonteAzul ">Estado:</td>
<td ><input name=" estado " type=" text " value=<jsp:getProperty name=" cli " property=" estado "/> size=" 50 "></td>
</tr>
<tr>
<td width=" 20 % " align=" center " class=" fonteAzul ">E-mail:</td>
<td><input name=" email " type=" text " value=<jsp:getProperty name=" cli " property=" email "/> size=" 50 "></td>
</tr>
<tr>
<td width=" 20 % " align=" center " class=" fonteAzul ">Telefone:</td>
<td><input name=" telefone " type=" text " value=<jsp:getProperty name=" cli " property=" telefone "/> size=" 10 "></td>
</tr>
<tr align=" center ">
&nbsp;
</td>
</tr>
</table>
<center><input type=" submit " value=" Alterar " name=" comando " class=" txtcinza ">
<input type=" submit " value=" Ver Reservas " name=" comando " class=" txtcinza " & gt ; & lt ; / center & gt ;
Tai o maldito :twisted:
matheusPJ 22 de jun. de 2005
q estranho, se tu trocar
<jsp:getProperty name="cli" property="nome"/>
por
no teu jsp mesmo, funciona? Ja testou?
nadoPJ 22 de jun. de 2005
Só testei no Servlet com out.println no JSP nunca!
Eu que pergunto será q. funciona???
matheusPJ 22 de jun. de 2005
“nado”:
Só testei no Servlet com out.println no JSP nunca!
Eu que pergunto será q. funciona???
meu… testa pra gente ir afunilando o problema. :???:
nadoPJ 22 de jun. de 2005
Pior que agora nao dá! só final da tarde.
Valeu.
bejetoPJ 22 de jun. de 2005
qual o codigo da sua jsp q exibe isso?
nadoPJ 22 de jun. de 2005
Esse ai
& gt ; & lt ; input name = "nome" type = "text" value = & lt ; jsp & # 58 ; getProperty name = "cli" property = "nome" /& gt ; size = "50" & gt ;
andre_marrentoPJ 22 de jun. de 2005
O que está faltando são as aspas (") no value do input… mude o seu código para
value="<jsp:getProperty name=“cli” property=“nome”/>"
T+