Mozilla , IE e JSP

7 respostas
boaglio

Gente, algo estranho ocorre quando acesso uma página JSP
com o Mozilla: aparece só o código fonte HTML.

Quando eu acesso com o IE a página aparece sem problemas.

Fiz o teste usando o famoso hello.jsp .

O que eu devo fazer?

Alterar o mime-type da página?

7 Respostas

Bani

Eu costumo deixar assim o header dos meus HTMLs (ou coisas que se transformarão em HTML):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>... título ...</title> </head>

Rafael_Steil

De um

response.setContentType("text/html");

Rafael

boaglio

Não funcionou nenhuma das duas opções.
Testei num Tomcat na minha máquina e funcionou, parece que
é alguma coisa na locaweb.

Rafael_Steil

Parece que eh alguma coisa no teu codigo… senao todas as paginas java que estao na locaweb deveriam estar dando problemas…

Como eh o seu codigo? se der, coloca ele ai, se nao for grande, ou o inicio pelo menos…

Rafael

boaglio

Rafael, o codigo nao tem nada demais, apenas o hello.jsp para testar
o suporte JSP do servidor:

<html>
<head>
<title>Sample Application JSP Page</title>
</head>
<body bgcolor=white>
<table border="0">
<tr>
<td align=center>
<img src="images/tomcat.gif">
</td>
<td>
<h1>Sample Application JSP Page</h1>
This is the output of a JSP page that is part of the Hello, World
application.  It displays several useful values from the request
we are currently processing.
</td>
</tr>
</table>
<table border="0" border="100%">
<tr>
  <th align="right">Context Path:</th>
  <td align="left"><%= request.getContextPath() %></td>
</tr>
<tr>
  <th align="right">Path Information:</th>
  <td align="left"><%= request.getPathInfo() %></td>
</tr>
<tr>
  <th align="right">Query String:</th>
  <td align="left"><%= request.getQueryString() %></td>
</tr>
<tr>
  <th align="right">Request Method:</th>
  <td align="left"><%= request.getMethod() %></td>
</tr>
<tr>
  <th align="right">Servlet Path:</th>
  <td align="left"><%= request.getServletPath() %></td>
</tr>
</table>
</body>
</html>

Testando localmente no meu Tomcat no Linux
( http://localhost:8080/hello.jsp ) aparece:

Sample Application JSP Page
This is the output of a JSP page that is part of the Hello, World application. It displays several useful values from the request we are currently processing.
Context Path: 	
Path Information: 	null
Query String: 	null
Request Method: 	GET
Servlet Path: 	/hello.jsp

Testando remotamente no servidor aparece o codigo fonte, como se a pagina
tivesse o MIME-type de text/txt .

Alterando o fonte JSP e colocando a sua sugestao ou a da Bani aparece a mesma
coisa.

Rafael_Steil

http://www.jforum.net/teste.jsp

Testei com o IE e com o Mozilla e apareceu igual ( correto ) em ambos…

Acessando esse link, como fica na sua maquina?

Rafael

boaglio

Então parece que é problema na minha conta lá mesmo…

Depois que eu reparei que no HTML do IE tinha trechos como:

request.getPathInfo()

que deveriam existir somente no código fonte e nunca no
resultado HTML.

Já abri um chamado lá… :wink:

Criado 23 de janeiro de 2004
Ultima resposta 26 de jan. de 2004
Respostas 7
Participantes 3