我正在使用此代码制作用户登录表单,问题是我能够从 Internet Explorer 登录,但是当我从 Firefox 登录时,相同的代码会在屏幕上打印代码的 HTML 版本。
此代码在登录后打印待处理列表:
<%@ page language = "java" import="java.util.Iterator" import="java.util.ArrayList" import="java.lang.*" contentType = "text/html; charset = ISO-8859-1"
%>
<%@ page errorPage="/error.jsp" %>
<%
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-store");
response.setHeader("Expires", "0");
response.setDateHeader("Expires", -1);
//session = request.getSession(false);
// session.invalidate();
// session = request.getSession(true);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>All Pending List </title>
<style type="text/css">
<!--
@import"Image/cssmenuvertical.css";
-->
</style>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<script language="JavaScript" type="text/JavaScript">
function goToURL()
{
window.location="logout.jsp";
}
function bck()
{
window.history.forward();
}
setTimeout("bck()",0);
</script>
<title>All Pending Details</title>
</head>
<body bgcolor="lightblue">
<% String val="for upload";
session.setAttribute("val", val);
%>
<%
if (session.getAttribute("aa") != null) {
%>
<%
String findval = "find validation";
session.setAttribute("findval", findval);%>
<form id="form_id" action="" method="" >
<table id='table1' align="center" >
<tr>
<td style="background-image: url(Image/header.jpg); width: 800px; height: 40px" color="lightblue"></td>
</tr>
<tr>
<td>
<ul id="navmenu">
<li><a href="#">Find ></a>
<ul>
<li><a href="Find_ip.jsp">By IP </a></li>
<li><a href="find_mac.jsp">By Mac Address </a></li>
<li><a href="find_date.jsp">By Date </a></li>
<li><a href="find_email.jsp">By Email </a></li>
<li><a href="find_approve">By Approved </a></li>
<li><a href="find_remove">By Removed </a></li>
<li><a href="find_reg.jsp">By Registration ID</a></li>
</ul>
</li>
<li><a href="AlluploadedForms">| Uploaded Forms ></a></li>
<li> <a href="logout.jsp">| Logout ></a>
</li>
</ul>
</td>
</tr>
</table><br/>
<center>
<FONT COLOR="#0000FF" size="4"><b>All Pending List</b></FONT>
<br/>
<br/>
</center>
<center>
<TABLE cellpadding="15" border="1" style="background-color: #C2DFFF">
<th ><FONT COLOR="#0000FF">Registration NO.</FONT></th>
<th><FONT COLOR="#0000FF">Administrator Name</FONT></th>
<th><FONT COLOR="#0000FF"> Email</FONT></th>
<th><FONT COLOR="#0000FF"> Division Name</FONT></th>
<th><FONT COLOR="#0000FF"> Registration Date</FONT></th>
<%
ArrayList all = (ArrayList) session.getAttribute("values");
Iterator i = all.iterator();
while (i.hasNext()) {
String t = (String) i.next();
out.println(t);
}
%>
</TABLE>
<table><tr><td>
<input type="button" name="logout" value="Logout" onclick="goToURL();"/></td></tr></table>
<%} else {
response.sendRedirect("logout.jsp");
}%>
</center>
</form>
<center><FONT COLOR="#0000FF"> Government Of India<br/>
Ministry Of Communications and Information Technology<br/>
Department of Information Technology </FONT></center>
</body>
从 Firefox 登录该页面后