unique within an element

从tomcat 6 升到 tomcat-7.0.12

jsp页面报:

org.apache.jasper.JasperException: /XXX/XXX.jsp(59,55) Attribute qualified names must be unique within an element

    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)....

原因:页面一个struts标签中定义了两个id属性的(工具没提示).

tomcat6正常,解析后取第二个id的值

如果非struts标签,页面解析后只取第一个属性

jsp(97,87) The JSP specification requires that an attribute name is preceded by whitespace

 

在tomcat7.0下,会报一个异常:

org.apache.jasper.JasperException: /head.jsp(1,84) The JSP specification requires that an attribute name is preceded by whitespace

head.jsp我是用<jsp:include page="head.jsp" flush="true"/>引入的,在tomcat6.0的环境下,不会报以上的异常,但在tomcat7.0会报这个异常,后来,仔细查了一下head.jsp文件第一行。原来我真的漏了一个空格,

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>

在pageEncoding之前漏了一个空格。改正,重新运行,ok了!

原因: struts标签 属性 之间要有空格

原文地址:https://www.cnblogs.com/legend_sun/p/3381453.html