org.apache.jasper.JasperException: - Page directive must not have multiple occurrences of pageencoding
最近写jsp遇到一系列的低级错误,记录下来权当前车之鉴吧。
错误提示:
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /jsp04/Zj04_sj_test1_1.jsp(2,1) Page directive must not have multiple occurrences of pageencoding
程序代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@ page language="java" import="jsp04.*" pageEncoding="gbk"%>
<%@ page import="javax.servlet.jsp.jstl.sql.Result;"%>
<%
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>民意调查</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>
<br>
在校大学生是否适合做兼职 <br>
<br>
<%
//构造sql语句,取出调查
String sql="select * from surveyItem where surveyID=1";
Object params[]={};
//获取调查项列表
Result result=DBHelp.runSelectSql(sql,params);
Map[] rows=result.getRows();
//循环访问每一个调查项
for(int i=0;i<rows.length;i++){
//得到调查项目的ID
int id=Integer.parseInt(rows[i].get("id").toString());
//得到调查项
String item=rows[i].get("item").toString();
%>
<input type="radio" name="radsurver" value="<%=id %>"><%=item %>
<%
}
%><br>
<input type="submie" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</body>
</html>
首先,org.apache.jasper.JasperException 中的JasperException
这个异常时jsp引擎解析jsp页面生成servlet时产生的,故错误是在转译阶段,应该是页面的语法有问题,而不是执行阶段出错
然后,检查一下配置,发现页面编码设置了两次,虽然是一样的编码,但还是不被允许的
最后,第二行改为:
<%@ page import="jsp04.*" %>
OK !
org.apache.jasper.JasperException: - Page directive must not have multiple occurrences of pageencoding的更多相关文章
- org.apache.jasper.JasperException: /WEB-INF/view/../../../common/common1.jsp (line: 7, column: 1) Page directive must not have multiple occurrences of pageencoding
本文为博主原创,未经允许,不得转载: 先还原错误: org.apache.jasper.JasperException: /WEB-INF/view/../../../../common/common ...
- Page directive must not have multiple occurrences of pageencoding
一个jsp文件中不能同时出现两个 p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #932192 } pageE ...
- Page directive: illegal to have multiple occurrences of contentType with different values
org.apache.jasper.JasperException: /commons/meta.jsp(1,1) PWC5988: Page directive: illegal to have m ...
- Struts2报错org.apache.jasper.JasperException: Invalid directive原因
struts标签书写错误.<s:textfield name="us.username"/>对的<s:textfield name="us.userna ...
- 解决报错 Page directive: illegal to have multiple occurrences of contentType with different values (old:
转自:https://blog.csdn.net/dorothy1224/article/details/78064288
- 报错:org.apache.jasper.JasperException: /jsp/head.jsp (line: 1, column: 2) Page directive: illegal to
上面报错提示的是org.apache.jasper.JasperException: /jsp/head.jsp (line: 1, column: 2) Page directive: illega ...
- org.apache.jasper.JasperException: An exception occurred processing JSP page /admin/jiaoshi/daochuEx
org.apache.jasper.JasperException: An exception occurred processing JSP page /admin/jiaoshi/daochuEx ...
- JSP异常之org.apache.jasper.JasperException(转)
According to TLD or attribute directive in tag file, attribute items does not accep t any expression ...
- org.apache.jasper.JasperException: Expecting "jsp:param" standard action with "name" and "value" attributes
jasper 英 ['dʒæspə] 美 ['dʒæspɚ] 跟读 口语练习 n. 碧玉:墨绿色 n. (Jasper)人名:(德)雅斯佩尔:(西)哈斯佩尔 JasperException 异 ...
随机推荐
- Elasticsearch与Solr
公司之前有个用Lucene实现的伪分布式项目,实时性很差,后期数据量逐渐增大的时候,数据同步一次需要十几小时.当时项目重构考虑到的是Solr和ES,我参与的是Solr技术的预研.因为项目实时性要求很高 ...
- kafka 0.8.2 消息消费者 consumer
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- 关于图的顶点染色问题的各种算法的C++实现之初探(一)——引言与简介
我是一个数学工作者,专业方向是图论.研究图论已经十年有余.一个月前,一个偶然的机会让我萌生了一个念头,那就是我想尝试用C++写出我所学过的图论方面的算法.作为一个数学工作者,过去一直是纸上谈兵,我之前 ...
- CCNA毕业测试
要求: 1:不同楼层物理隔离,但逻辑相连 2:相同楼层物理相连,但逻辑隔离 3:主机可以动态获取IP地址 4:不同VLAN间可以进行通信 5:主机最终访问www.baidu.com弹出Congratu ...
- Windows平台下python2和3的兼容问题解决
很多朋友都安装了python2和3,因为用些库例如scapy,不是scrapy,python3下面都是错,那么怎么让python2和3共存呢. 像一般的程序员,达到如下效果 Windows平台下的兼容 ...
- coreCLR系列随笔 之ClrJit项目之alloc.cpp文件分析(1)
首先声明,自己对CLR了解得不多,只是个人爱好,可能有错误,请指出,文件源码如下(可能不是最新的) // // Copyright (c) Microsoft. All rights reserved ...
- BUGKUctf-web-writeup
---恢复内容开始--- 找到了个ctf平台.里面的web挺多的.终于将web题目写的差不多了. Web 签到题 加群就可以了 Web2 直接F12就看到了 文件上传测试 Burp抓包 文件名改成 1 ...
- [Leetcode] Binary search--275 H-Index
Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize ...
- PHP验证码的制作教程
自己过去自学了PHP绘画验证码的教程,现在就把这一部分笔记跟大家分享,希望可以帮到大家. 顺带,我会在后面把我整理的一整套CSS3,PHP,MYSQL的开发的笔记打包放到百度云,有需要可以直接去百度云 ...
- spring boot 入门操作(二)
spring boot入门操作 使用FastJson解析json数据 pom dependencies里添加fastjson依赖 <dependency> <groupId>c ...