Servlet跳转进入JSP页面什么都不显示?

AslenG 2012-08-28 05:54:05
servlet代码:

public class TestServlet extends HttpServlet {

private static final long serialVersionUID = 5222793251610509039L;

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
request.setCharacterEncoding("UTF-8");

}

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}

}


JSP代码:
<%@ page language="java" import="java.util.*" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.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">
<script>
window.onload=function(){
alert("");
}
</script>
</head>
<body>
用户名:<input type="text" id="username" onblur=""/><label id="msg"></label>
</body>
</html>


加入小脚本就可以显示,但加入js和html代码都无法显示,怎么会这样呢?
...全文
98 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
AslenG 2012-08-28
  • 打赏
  • 举报
回复
偶然发现了问题所在,我没有重新部署和重启浏览器,缓存很严重啊。
liuyyuns 2012-08-28
  • 打赏
  • 举报
回复
没理解楼主的意思
AslenG 2012-08-28
  • 打赏
  • 举报
回复
貌似要沉啊~555
AslenG 2012-08-28
  • 打赏
  • 举报
回复
“加入小脚本就可以显示,但加入js和html代码都无法显示,怎么会这样呢?” 我的意思是可以显示小脚本,js和html代码都无法显示,大家可以看到我测试用的js代码,进入页面都不执行。

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧