White space JSTL

Asked

Viewed 125 times

3

I have a very annoying problem, when my jsp is mounted I have a jstl foreach that leaves my final code absurdly giant, worse than I realized it’s just blank space. Follows the code :

   <c:forEach var="column" items="${tela.targetXml.column}" varStatus="rowStatus" >
        <c:set var="podeAdicionar" value="true" />
        <c:forEach var="col" items="${tela.columns}" varStatus="colTelaStatus" >
            <c:if test="${col.nome == column.name}">
                <c:set var="podeAdicionar" value="false" />
            </c:if>
        </c:forEach>
        <c:if test="${column.visivel && podeAdicionar}">
            div2 = jQuery('<div class="col-md-12" onclick="adicionarColuna(\'${column.name}\', \'${column.label}\', this);event.preventDefault();event.stopPropagation();">');
            lb = jQuery('<label name="${column.name}">').text('${column.label}');
            div2.append(lb);
            div.append(div2);
        </c:if>
    </c:forEach>

This stretch of foreach leaves this space blank : inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

Need to remove this, the ideal would be not need to mimic the file to avoid errors.

  • 1

    What happens if you put <%@ page trimDirectiveWhitespaces="true" %> at the beginning of the page?

  • 1

    I went after this configuration after your reply and managed to resolve it in web.xml, thanks for the tip.

1 answer

3

I was able to resolve by adding the following configuration to my web.xml :

  <jsp-config>  
     <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <trim-directive-whitespaces>true</trim-directive-whitespaces>
     </jsp-property-group>
  </jsp-config>

This setting removed on all my pages and worked smoothly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.