读书人

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

发布时间: 2012-09-11 10:49:03 作者: rapoo

Servlet跳转进入JSP页面什么都不显示?
servlet代码:

Java code
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代码:
HTML code
<%@ 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代码都无法显示,怎么会这样呢?

[解决办法]
没理解楼主的意思

读书人网 >Java Web开发

热点推荐