This is a problem that I have very often I do not attach code because it happens to me in all the JSP
The problem you have is because after the directives you are using they have a return of the car after them.
Look at the following example:
<%@include file="..." %>(retorno del carro)
HOLA
It will generate the following output:
(lo que genere el archivo ...)(retorno del carro)
HOLA
However the following example:
<%@include file="..." %>HOLA
It will generate:
(lo que genere el archivo ...)HOLA
To change this behavior in a particular file you can use the trimDirectiveWhitespaces
directive as follows:
<%@ page trimDirectiveWhitespaces="true" %>
<%@include file="..." %>(retorno del carro)
HOLA
Generating directly the following output:
(lo que genere el archivo ...)HOLA
You can check at runtime whether this policy is enabled or not by using JspPropertyGroupDescriptor.getTrimDirectiveWhitespaces()
.
You can also set it globally in web.xml
with a set of group properties (in this case all files *.jsp
) of the following way:
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group>
</jsp-config>