zzl001 发表于 2018-12-3 09:02:53

tomcat升级报错

  问题1      出现:
Attribute value request.getContextPath() + "/formula/taskRepetition.do" is quoted with " which must be escaped when used within the valuehttp://s3.运维网.com/wyfs02/M01/70/D8/wKiom1W_J-yj3h50AACV0os05OI081.jpg
  访问JSP时,报错:Attribute value is quoted with " which must be escaped when used within the value 。相信很多人都遇到过,以下结合本人查资料与亲自实践得到的结论。
  有不对的地方还请指教。
  1):错误常发生的位置 value=""
  2):错误产生的原因,是因为tomcat版本升级后(6.0以后),对双引号的处理机制引起的,如果出现双引号包含双引号的情况,就可能会出现这个错误。
  3):解决办法有好多种,大多数网上的意见是改为value=‘’这样确实可以解决这个报错,可能无法完全解决问题,比如项目中有很多地方以前都用的是双引号,修改起来会非常麻烦,还容易出错。

  查看tomact文档有一段话这样描述的“If false the requirements for escaping quotes in JSP attributes will be>  If not specified, the specification compliant default of true will be used.”    这个描述针对的是tomact的org.apache.jasper.compiler. Parser.STRICT_QUOTE_ESCAPING属性。
  如此一来,我们知道只要在tomcat启动时将这个属性设为false就可以解决这个问题。
  那么怎么将这个属性设置到tomcat的system属性中呢,有至少两个办法:
  一种是利用tomcat启动的执行脚本,在执行过程中调用setenv.sh,在其中设置环境变量,如:JAVA_OPTS=%JAVA_OPTS%: -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
  (最好是在${tomcat}/bin/catalina.sh中追加
  CATALINA_OPTS="-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false"
  )
  另一种是找到conf/catalina.properties文件,在最后添加org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false 即可。
  转载:
  http://blog.csdn.net/eagleking012/article/details/6666860
  问题1    出现
  The JSP specification requires that an attribute name is preceded by whitespace
  
  是对应的jsp页面标签中没有加空格造成的
  eg:
  
上传附件:
  

  

  styleId处
  也可以在conf/catalina.properties文件,在最后添加
  org.apache.jasper.compiler.Parser.STRICT_WHITESPACE=false
  


页: [1]
查看完整版本: tomcat升级报错