Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
trim-directive-whitespaces - Seriously has anyone gotten this to work?
Joined: Feb 07, 2002
Feb 02, 2012 12:33:54
I want to prevent jsp directives from inserting blank lines into the markup. I found some great info here:
This article lists two ways to do this:
use a page directive
add a setting to web.xml
The page directive does the job, but it stinks that I have to go in and put that on every jsp I have. That's just inefficient.
The other way to do this is preferable, which is just adding this setting to web.xml:
<jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <trim-directive-whitespaces>true</trim-directive-whitespaces> </jsp-property-group> </jsp-config>
..but I can NOT for the life of me get this to work.
My jsp and
version should support this; I'm running the following:
Server info: Apache Tomcat/7.0.19
Servlet version: 3.0
Java version: 1.6.0_29
Has anyone been able to get the web.xml solution for this to work?
Author and ninkuma
Joined: Jan 10, 2002
Feb 02, 2012 13:15:05
I've never tried using it as I've never worried about the extra whitespace. But one reason might be that your URL
isn't matching your requests.
If you are following best practices and using servlet page controllers that forwards to the JSPs, the URL will be that of the controller and not one that ends with .jsp.
If you are addressing the JSPs directly however, I got nothing.
Asking smart questions
Books by Bear
Joined: Feb 07, 2002
Feb 02, 2012 17:52:43
great suggestion - but no luck.
I changed the url-pattern to:
but it still didn't work. really good ide though.
anyone else out there come across this?
I agree. Here's the link:
subject: trim-directive-whitespaces - Seriously has anyone gotten this to work?
Unable to get the login.jsp to fire from example of book "Java EE 5 Development with NetBeans 6"
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014