The Artima Developer Community
Sponsored Link

Java Buzz Forum
Trim Spaces in your JSP's HTML

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Matt Raible

Posts: 422
Nickname: mraible
Registered: Jul, 2003

Matt Raible is a J2EE Consultant in Denver, Colorado.
Trim Spaces in your JSP's HTML Posted: Mar 24, 2005 2:32 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Matt Raible.
Original Post: Trim Spaces in your JSP's HTML
Feed Title: Raible Designs ~ We Build Web Apps
Feed URL: http://static.raibledesigns.com/500.html
Feed Description: Opinions and tips on how to build web applications using Java. Currently using Hibernate, Struts, XHTML, CSS, Ant, JUnit and XDoclet.
Latest Java Buzz Posts
Latest Java Buzz Posts by Matt Raible
Latest Posts From Raible Designs ~ We Build Web Apps

Advertisement
One of the annoying things about JSPs is all of the dynamic (non-rendered) parts of the page still produce line breaks. This means that if you do a view-source, you'll likely see large blocks of whitespace.

The good news is you can get rid of this whitespace if you're using Tomcat 5.5.x. Just locate the "jsp" servlet in $CATALINA_HOME/conf/web.xml and add the following <init-param>:

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

I tested it and it works great. This begs the question - why isn't this on by default? Source: Struts Mailing List.

Read: Trim Spaces in your JSP&#39;s HTML

Topic: [Mar 18, 2005 00:04 PST] 5 Links Previous Topic   Next Topic Topic: Podcast Kit: What you need and how to set it up

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use