Hicham Mouloudi created MTOMCAT-321:
---------------------------------------
Summary: trimDirectiveWhitespaces does not apply for custom tags
in Tomcat provided jasper lib
Key: MTOMCAT-321
URL: https://issues.apache.org/jira/browse/MTOMCAT-321
Project: Apache Tomcat Maven Plugin
Issue Type: Bug
Environment: tomcat.version : 7.0.82.A.RELEAS
spring.version : 4.3.17.RELEASE7
java.version : 1.8
Reporter: Hicham Mouloudi
Attachments: image-2020-11-27-14-03-02-603.png,
image-2020-11-27-14-08-01-135.png, image-2020-11-27-14-15-31-718.png
Hello,
We have a Spring based web application project where we have about 350 custom
tags under /WEB-INF/tags/. When inspecting the source page html, we can see a
lot of generated white spaces between html elements (arround 5000 back to lines
added).
We already have the configuration in the jsp level as follow
{code:java}
<jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <!-- Disable
JSP scriptlets and expressions --> <scripting-invalid>true</scripting-invalid>
<!-- Remove additional whitespace due to JSP directives -->
<trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group> </jsp-config>
{code}
And we also declared the <%@ page trimDirectiveWhitespaces="true" %> inside our
jsp custom pages.
We want to trim white space in all custom tags, so we need to add <%@ tag
trimDirectiveWhitespaces="true" %> we had some blocking issues as this
directive on tag level trim inner html element spaces
For example a radio button that have checked directive inside will be like
<input type="radio" value="ex" checkeddata-track-event="somevalue" ../>
!image-2020-11-27-14-08-01-135.png|width=508,height=74!
You can notice that the checked is concatenated with the field data-track-event.
We also tried the following configuration
{code:java}
<jsp-property-group>
<url-pattern>*.tag</url-pattern>
<trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group>
{code}
But this is blocked by the JspConfig class.
!image-2020-11-27-14-03-02-603.png|width=977,height=292!
So adding <%@ tag trimDirectiveWhitespaces="true" %> to prevent those
generated white space in all our custom tags will have an expected error in our
production code, as it will required a lot of test and analysis. And with this
issue of removing inner html element white space we are afraid to break all
existing front end functionalities, like checkout pages, user registration,
order creations ...
Can you please help on this issue by providing us with a fix or a workaround ?
tomcat.version : 7.0.82.A.RELEAS
spring.version : 4.3.17.RELEASE7
java.version : 1.8
!image-2020-11-27-14-15-31-718.png|width=584,height=179!
Best Regards
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]