Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSTL Markup generated whitespace problem

800368Feb 20 2008 — edited Feb 20 2008
I am facing a big problem in the website that I am building due to the whitespace that is being generated from the JSTL code. The number of bytes written out as html markup is nearly similar to the number of whitespace characters that get written for all the JSTL code. This has made my jsp very unoptimized. While using scriptlet I used to buffer the HTML in stringBuffer and do a final out.print on the StringBuffer. But i could not find any such method in JSTL. The code snippet is pasted below, after all the logical processing I am just outputting an html li element with some markup inside it. Unfortunately, JSTL is pumping out all the whitespace that is in the jstl code also.

Please help me?
<div class="imageHolder">
        <ul class="imageList">
            <c:catch var="currentMapError">
	            <c:forEach items="${cwmBeansAtr}" var="bean" varStatus="loopStatus">
	                
	                <c:choose>
	                   <c:when test="${fn:length(fn:trim(bean.skyCode)) < 2}">
                           <c:set var="condCssClass">
							   imageCondition imageType-md imageType-0${bean.skyCode}
                           </c:set>
	                   </c:when>
	                   <c:otherwise>
	                       <c:set var="condCssClass">
                                weatherCondition weatherType-md weatherType-${bean.skyCode}
                           </c:set>
	                   </c:otherwise>
	                </c:choose>
	                
	                <c:choose>
	                    <c:when test="${requestScope.temperatureUnit eq 'c'}">
	                        <c:set var="hiTemperature" value="${bean.highTempC}"/>
	                        <c:set var="loTemperature" value="${bean.lowTempC}"/>
	                    </c:when>
	                    <c:otherwise>
	                        <c:set var="hiTemperature" value="${bean.highTempF}"/>
	                        <c:set var="loTemperature" value="${bean.lowTempF}"/>
	                    </c:otherwise>
	                </c:choose>
	                
	                <li class="${condCssClass}" style="left:${bean.XCoord}px;top:${bean.YCoord}px;" title="${bean.cityName}">
	                    <a href="http://weather.aol.com/main.adp?location=${bean.locationID}">
	                        <span class="tempValJSH hi" title="high" id="cwmHi${loopStatus.count}">${hiTemperature}</span>
	                        <span class="tempValJSH low" title="low" id="cwmLo${loopStatus.count}">${loTemperature}</span>
	                    </a>
	                </li>
	                <c:if test="${loopStatus.last}">
	                    <c:set var="totalCWMCities" value="${loopStatus.count}"/>
	                </c:if>
	            </c:forEach>
            </c:catch>
            
            <c:if test="${not empty currentWeatherMapError}">
                <!-- Error in the current weather module ${currentWeatherMapError}.  -->
            </c:if>
        </ul>
    </div>
    <p class="more"><a href="#">More Maps</a></p>
</div>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 19 2008
Added on Feb 20 2008
10 comments
833 views