使用ajax碰到的问题
问题描述如下:
function callServer()
{
xmlHttp.open("GET",'login.jsp',false);
xmlHttp.onreadystatechange = updatePage;
xmlHttp.send(null);
}
function updatePage()
{
if(xmlHttp.readyState == 4)
{
var response = xmlHttp.responseText;
alert(response);
td1.innerHTML=response;
}
}
然后login.jsp的内容
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
response.setContentType("text/html");
out.println("well");
%>
我希望就是接收到well,但总是什么都显示不出来
如果我吧login改成一个标准的html格式的网页
类似这样:
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
request.setCharacterEncoding("GB18030");
String msg = request.getParameter("msg");
String back = request.getParameter("back");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'msg.jsp' starting page</title>
<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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
well
</body>
</html>
well就能显示出来,但如果用
<body>
<%out.println("well");%>
</body>
也显示不出来
网上搜了一下,发现几个解决方法都不行
下面这个贴和我的情况比较像
http://topic.csdn.net/u/20081124/17/3d6e3e72-4646-45e5-a51a-0522730155d2.html
菜鸟求问。。。