Help us understand the problem. What is going on with this article?

tomcat8.5でSTRICT_QUOTE_ESCAPINGの設定をCATALINA_OPTSに書いても反映されない

More than 1 year has passed since last update.

tomcat5.5くらいからjspのスクリプトレット内でクォートを使おうとするとエスケープしないといけなくなっていたが
これをいちいちエスケープするのは面倒なので、
org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
と設定すればそのまま使えていた。
参考:http://d.hatena.ne.jp/guangda/20091215/1260836855

自分がいた環境では2の「CATALINA_OPTS」に設定を追加していたが、tomcat8.5にした際に本設定を追加しても効かず500エラーが発生!
プロセスを見ても引数として設定もされているが効いていなかった。

調査中にふとweb.xmlの差分を見てみると
tomcat8まで

  <!--   strictQuoteEscaping When scriptlet expressions are used for        -->
  <!--                       attribute values, should the rules in JSP.1.6  -->
  <!--                       for the escaping of quote characters be        -->
  <!--                       strictly applied? [true]                       -->
  <!--                       The default can be changed with the            -->
  <!--                       org.apache.jasper.compiler.Parser.             -->
  <!--                       STRICT_QUOTE_ESCAPING system property.         -->

tomcat8.5から

  <!--   strictQuoteEscaping When scriptlet expressions are used for        -->
  <!--                       attribute values, should the rules in JSP.1.6  -->
  <!--                       for the escaping of quote characters be        -->
  <!--                       strictly applied? [true]                       -->

?!この部分の記載が消えている事が判明

  <!--                       The default can be changed with the            -->
  <!--                       org.apache.jasper.compiler.Parser.             -->
  <!--                       STRICT_QUOTE_ESCAPING system property.         -->

そこでweb.xml側のこのコメントの後に

<servlet>
  <servlet-name>jsp</servlet-name>
  <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
  ~略~
  <init-param>
    <param-name>strictQuoteEscaping</param-name>
    <param-value>false</param-value>
  </init-param>
  ~略~
</servlet>

を追加した所、500エラーが消えた( ゚д゚)wow……

以上。まだ誰もこの地雷を踏んでいないみたいなので、一応。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした