You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Mark Thomas (Jira)" <ji...@apache.org> on 2020/11/27 19:33:00 UTC

[jira] [Resolved] (MTOMCAT-321) trimDirectiveWhitespaces does not apply for custom tags in Tomcat provided jasper lib

     [ https://issues.apache.org/jira/browse/MTOMCAT-321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved MTOMCAT-321.
---------------------------------
    Resolution: Invalid

This looks like a Tomcat issue rather than a Tomcat Maven plugin issue so please raise it via Tomcat's issue tracker: [http://tomcat.apache.org/bugreport.html]

Generally, if you can provide a minimal test case that demonstrates the bug that speeds up resolution of the issue.

> 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.RELEASE
> spring.version :  4.3.17.RELEASE
> java.version :  1.8
>            Reporter: Hicham
>            Priority: Major
>         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, image-2020-11-27-14-17-23-102.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 (around 5000 back to lines added). 
> !image-2020-11-27-14-17-23-102.png|width=573,height=386!
> We already have done 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've added the directive <%@ tag trimDirectiveWhitespaces="true" %>. And  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 it  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 spaces in all our custom tags will have an expected errors and very difficult to identify in our production code, as it will required a lot of tests and analysis.
> And with this unexpected side effect of removing inner html element white spaces, 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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org