最近写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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. Struts2报错org.apache.jasper.JasperException: Invalid directive原因

    struts标签书写错误.<s:textfield name="us.username"/>对的<s:textfield name="us.userna ...

  5. 解决报错 Page directive: illegal to have multiple occurrences of contentType with different values (old:

    转自:https://blog.csdn.net/dorothy1224/article/details/78064288

  6. 报错: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 ...

  7. 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 ...

  8. JSP异常之org.apache.jasper.JasperException(转)

    According to TLD or attribute directive in tag file, attribute items does not accep t any expression ...

  9. org.apache.jasper.JasperException: Expecting "jsp:param" standard action with "name" and "value" attributes

      jasper  英 ['dʒæspə]  美 ['dʒæspɚ] 跟读 口语练习 n. 碧玉:墨绿色 n. (Jasper)人名:(德)雅斯佩尔:(西)哈斯佩尔 JasperException 异 ...

随机推荐

  1. Graphical Analysis of German Parliament Voting Pattern

    We use network visualizations to look into the voting patterns in the current German parliament. I d ...

  2. angular实现的文字上下无缝滚动

    最近在学习angularJs,业余时间随便写了一个文字上下无缝滚动的例子,主要写了一个小小的指令. css代码:主要控制样式 <style type="text/css"&g ...

  3. Java中的向上造型和向下造型等

    package com.study.oop.day01; /**  * 如果某个方法是静态 的,它的行为就不具有多态性  * @author LuHongGang  * @date 2017年6月5日 ...

  4. 从零开始理解JAVA事件处理机制(2)

    第一节中的示例过于简单<从零开始理解JAVA事件处理机制(1)>,简单到让大家觉得这样的代码简直毫无用处.但是没办法,我们要继续写这毫无用处的代码,然后引出下一阶段真正有益的代码. 一:事 ...

  5. 设计模式一:关于C++写观察者模式的一些收获

    先贴上部分代码: #include "stdafx.h" #include<iostream> #include<string> #include<v ...

  6. spring管理配置文件的工厂类--PropertiesFactoryBean

    使用这个工厂的配置,可以很方便的获取配置文件中的属性.具体使用如下; 对于属性配置,一般采用的是键值对的形式,如: key=value 属性配置文件一般使用的是XXX.properties,当然有时候 ...

  7. 深入分析Java的String类的方法与特点

    字符串是任何编程语言都必须支持的变量类型,有些编程语言是直接提供了原生的变量类型,有些编程语言则使用语法特性以 SDK 的形式提供支持.在Java编程平台中,对字符串的支持使用了后者的形式,就是通过在 ...

  8. 用Backtrack进行渗透测试评估

    Web应用程序的分析在渗透测试和漏洞评估中发挥了重要的作用.确定Web应用程序的正确信息(例如使用的插件,CMS类型等)都可以帮助测试者使用准确的漏洞来测试,能够降低整个渗透测试漏洞评估所花费的时间. ...

  9. 【麦克风阵列增强】Delay and sum beamforming

    作者:桂. 时间:2017-06-03  15:40:33 链接:http://www.cnblogs.com/xingshansi/p/6937576.html 前言 本文主要记录麦克风阵列的几个基 ...

  10. cms基本概念(dedecms,phpcms)

    1.什么是cms? cms是"Content Management System"的缩写,意为"内容管理系统". 内容管理系统是企业信息化建设和电子政务的新宠, ...