我的文件index.jsp文件如下:
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%
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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%@ include file ="login.jsp"%>
<%out.println("请求长度:"+ request.getContentLength()); %><br>
<%out.println("请MIME类型:"+request.getContentType()); %>
</body>
</html>而login.jsp文件如下
<table border=0>
<tr align="right"><td>
<form action="show.jsp" method= "post">
username
<input type = text name=username >
password
<input type =password name = password >
</form>
</td>
</tr>
</table>运行出现提示login.jsp not found
我是把两个文件放在同一个目录下的
请你们帮忙解决 谢谢
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%
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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%@ include file ="login.jsp"%>
<%out.println("请求长度:"+ request.getContentLength()); %><br>
<%out.println("请MIME类型:"+request.getContentType()); %>
</body>
</html>而login.jsp文件如下
<table border=0>
<tr align="right"><td>
<form action="show.jsp" method= "post">
username
<input type = text name=username >
password
<input type =password name = password >
</form>
</td>
</tr>
</table>运行出现提示login.jsp not found
我是把两个文件放在同一个目录下的
请你们帮忙解决 谢谢
高级模版很容易出现这个路径问题<%@ include file ="/login.jsp"%>
试下
是不是改过了代码或文件名什么的
,重新编译,部署,运行下看行不行
<jsp:include page="login.jsp"> </jsp:include>
或者
<%@ include file ="/login.jsp"%>试试!
遇到这种问题,慢慢试试就行了!!