0
I have problems accentuating the registration. If I register names with accent, they leave confused, I do not know if it is some sql problem. I already changed the utf8 for this but the text of the site gets confused.
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="cadastro_costumização.css"/>
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-family: Times New Roman, Times, serif;
font-size: 16px;
color: #000;
}
h1{
color:#00F;
font-family:Georgia, "Times New Roman", Times, serif;
font-size:24px;
}
p{
color:#003
font-family:Georgia, "Times New Roman", Times, serif;
font-size:22px;
}
table{
background-color: #69F;
}
-->
</style></head>
<body>
<p align="center">Manuntenção do Bairro</p>
<p align="center"><img src="img/loja.png" width="290" height="158" /></p>
<a href="#" onclick="window.open('imprime_usuario.jsp')">impressão na tela cheia</a>
<div align="center"></br> <p>Cadastre e Impresse
aqui</p>
<a href="bairro_cadastro.jsp"><img src="img/cadstrar.png" width="82" height="83" /></a><a href="imprime_usuario.jsp"><img src="img/indice.jpg" width="82" height="83" /></a>
<h1><strong>Ordenação: <a href="bairro.jsp?ordenacao=crescente">Crescente</a>- <a href="bairro.jsp?ordenacao=alfabetica">Alfabética</a></strong></h1></div>
<div align="center" >
<table width="777" border="0">
<tr>
<td width="150"><div align="center"><p>Código</p></div></td>
<td width="251"><div align="center">
<p>Nome do bairro</p></div></td>
<td width="254"><div align="center"><p>Alterar</p></div></td>
<td width="104"><div align="center"><p>Excluir</p></div></td>
</tr>
<%
try
{
Class.forName("org.postgresql.Driver");
//out.println("Conceguiu carregar o drive<br>");
Connection con = DriverManager.getConnection("jdbc:postgresql://localhost/js","postgres","1974");
//out.println("Conexão com sucesso");
Statement st = con.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
//out.println("passou pelo Statement ");
if(request.getParameter("acao")!= null)
{
st.executeUpdate("delete from bairro where bai_codigo="+request.getParameter("codigo"));
}
ResultSet rs = null;
if(request.getParameter("ordenacao")== null)
{
rs = st.executeQuery("select * from bairro order by bai_nome ");
}
else if(request.getParameter("ordenacao").equals("crescente"))
{
rs = st.executeQuery("select * from bairro ");
}
else if(request.getParameter("ordenacao").equals("alfabetica"))
{
rs = st.executeQuery( "select * from bairro order by bai_nome");
}
while(rs.next())
{ %>
<tr>
<td><div align="center"><%=rs.getString("bai_codigo") %></div>
</td>
<td><div align="center"> <%=rs.getString("bai_nome") %></div></td>
<td><div align="center">
<form id="form1" name="form1" method="post" action="">
<a href="bairro_altera.jsp?codigo=<%=rs.getString ("bai_codigo")%>&bairro=<%=rs.getString("bai_nome")%>"><img src="img/POWER - SWITCH USER.png" width="30" height="30" /></a>
</form>
</div></td>
<td><div align="center"><a href="bairro.jsp?acao=excluir&codigo=<%=rs.getString("bai_codigo")%>"><img src="img/Lixeiras_1545_Poubelle_v3.png" width="30" height="30" /></a></div></td>
</tr>
<% }
}
catch(ClassNotFoundException erroClass)
{
out.println("Driver não localizado,erro="+ erroClass);
}
catch(SQLException erroSQL)
{
out.println("Erro de conexão com o Banco de dados,erro="+ erroSQL);
}
%>
</table>
</div>
</body>
</html>
Try: <%=out.println(rs.getString("bai_codigo")) %> ; <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> and <%@pagelanguage="java" contenttype="text/html;UTF-8" pageEncoding="UTF-8" %>
– Andre Mesquita
adds this <meta http-equiv="Content-Type" content="text/html; charset='UTF-8'>
– Victor
I couldn’t, from the mistake
– brunoangola