Alex Rivera | Logout

How to properly escape triple nested quotes in JSP tags

Asked 2009-08-06T20:54:03.157
10

We just upgraded Tomcat and the newer Tomcat doesn't like nested quotes in the tag, so we have to alternate between single and double quotes. For example,

We used to have,

<form id="search" action="<fmt:message key="search.url"/>">

Now we can change it to,

<form id="search" action="<fmt:message key='search.url'/>">

What should I do if the quotes are triply nested like this,

<form id="search" action="<fmt:message key='<c:out value="${requestScope.search_url}"/>'/>">

The above tag doesn't compile.

Edit
Report

1 Answer

5

If you don't want do update all your jsp:s just for the tomcat upgrade, set the system property "org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING" to false.

Easiest way to this is by editing catalina.sh and adding the following to JAVA_OPTS:

-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false  
answered 2009-08-06T22:48:46.217

Your Answer