Blog from an ATG Developer

May 22, 2009

White Space problem in ATG Application

Filed under: ATG, JSP — madhulal @ 9:11 am
Tags: , , ,

We had an issue in one of the previous projects. The problem is that the html page getting generated has more white spaces and the resulting html size is too much. We can avoid this thing by modifying the deployment descriptor.

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

Also we can use the following pattern to reduce white spaces alternatively in dsp pages.

<dspel:page
><dspel:droplet name=”/test”
><dspel:oparam name=”output”
>Name: <dspel:valueof param=”test”
/></dspel:oparam
></dspel:droplet
></dspel:page>

Another approach is to use JSP comments instead of new lines.

<dspel:page><%–
–%><dspel:droplet name=”/test”><%–
–%><dspel:oparam name=”output”><%–
–%>Name: <dspel:valueof param=”test”/><%–
–%></dspel:oparam><%–
–%></dspel:droplet><%–
–%></dspel:page>

NB:- I know the code fragments provided in the topics are very low in readability. Please blame WordPress….

Reference:
1. http://betweengo.com/2008/08/22/trim-white-space-from-jsp/
2. http://www.caucho.com/resin-3.0/jsp/faq.xtp

Blog at WordPress.com.