<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
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 'Jsp1.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>
    This is my JSP page. <br>
    <%
    out.println("Hello World");
     %>
  </body>
</html>这个代码没错吧

解决方案 »

  1.   

    用startup.bat启动服务器,访问jsp页面就成功,但在MyEclipse里启动服务器访问jsp页面就不行,请问是什么问题呢
      

  2.   

    <base href=" <%=basePath%>"> ?这句是什么意思?把你的代码放到我的tomcat下可以运行
      

  3.   

    应该是Tomcat自动启动问题
    具体操作:
    打开控制面板-->管理工具-->服务, 找到Apache Tomcat,将自动改为手动
    再看看好了没
      

  4.   

    对了 ,记得要把Apache Tomcat这个服务重新启动一下,那个配置才能生效