Search This Blog

Thursday, February 11, 2010

Should white spaces in template text between actions or directives be trimmed?

Sometimes when we generate response text from a JSP page, we will get white spaces/lines in the response text. To avoid that we have to configure our tomcat web.xml file. Follow below steps to avoid the white spaces.


Goto Tomcat Directory/conf folder
Open web.xml file to edit.
Search for a  <servlet> tag, where you can find <servlet-name>jsp</servlet-name> .
Add <init-param> tag as like below:


<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>


Save the web.xml file and restart the tomcat.


It will remove white spaces from your response text.

No comments:

Post a Comment