
jsp中运用include指令,报错,两个界面单独打开都没问题,一用include就不行了
date.jsp<%@pagelanguage="java"import="java.util.*,java.text.*"contentType="text/html;...
date.jsp
<%@ page language="java" import = "java.util.*,java.text.*" contentType="text/html; utf-8"
pageEncoding="utf-8"%>
<%
Date d = new Date();
out.println(d);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
String s = sdf.format(d);
out.println(s);
%>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
include.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<h1>include指令</h1>
<hr>
<%@ include file="date.jsp"%>
<hr>
</body>
</html>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
报错
HTTP Status 500 - /date.jsp (line: 1, column: 2) Page directive: illegal to have
multiple occurrences of contentType with different values (old: text/html;
charset=utf-8, new: text/html; utf-8) 展开
<%@ page language="java" import = "java.util.*,java.text.*" contentType="text/html; utf-8"
pageEncoding="utf-8"%>
<%
Date d = new Date();
out.println(d);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
String s = sdf.format(d);
out.println(s);
%>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
include.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<h1>include指令</h1>
<hr>
<%@ include file="date.jsp"%>
<hr>
</body>
</html>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
报错
HTTP Status 500 - /date.jsp (line: 1, column: 2) Page directive: illegal to have
multiple occurrences of contentType with different values (old: text/html;
charset=utf-8, new: text/html; utf-8) 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询