日期:2014-05-17  浏览次数:20613 次

jsp 求解释
<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String str=request.getParameter("submit");
if(str==null){
str="";
}
if(str.equals("yes")){
response.setContentType("application/msword;charset=UTF-8");
}
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>response示例</title>
</head>
<body>
<p>我正在学习response对象
<p>将当前页面保存为word文档吗?
<form method="get" name="form">
<input type="submit" name="submit" value="yes">
</form>
</body>[color=#FF6600][/color]
</html>


我想问一下 为什么 最后在浏览器中运行之后显示的就是是一个文件的下载形式 这个是跟


response.setContentType("application/msword;charset=UTF-8");
这个有关吗 ?这个哪位大侠能帮我解释下 他的意思 我是菜鸟 谢谢

------解决方案--------------------
你是怎么运行的,有在服务器里面部署吗?
response.setContentType("application/msword;charset=UTF-8");
这个代表响应回来的数据格式。
------解决方案--------------------
这个代表页面显示结构 
这个是word形式是下载
 去掉就可以了