当前位置: 代码迷 >> JavaScript >> web头部设置的有关问题
  详细解决方案

web头部设置的有关问题

热度:149   发布时间:2012-03-14 12:01:13.0
web头部设置的问题
<%@ page contentType="text/html; charset=gb2312" 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=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
request.setCharacterEncoding("gb2312");
String username=request.getParameter("textfield1");
String password=request.getParameter("textfield2");
if(username.equals("aaa")&&password.equals("111"))
{response.setContentType("application/msword;charset=gb2312");
 out.println("好样的");
}
else
{ response.setContentType("application/msword;charset=gb2312");
  out.print("没戏");
}
%>
</body>
</html>


上面的代码是获取登陆界面的用户名和密码,在设置响应的头部,让结果以word文档的形式保存。当我登陆之后,跳转到此页面,保存此页面的结果,保存的文件类型怎么是JavaScript Source Code.jsp??这儿没用脚本语言啊?还有当把保存的结果用word打开时,只有“好样的”这一结果,当以文本打开时怎么还有html语言??


------解决方案--------------------
因为你前面的内容没有clear()啊
  相关解决方案