• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

trim-directive-whitespaces - Seriously has anyone gotten this to work?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I want to prevent jsp directives from inserting blank lines into the markup. I found some great info here:

http://stackoverflow.com/questions/208736/strip-whitespace-from-jsp-output

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:



    ..but I can NOT for the life of me get this to work.

    My jsp and servlet version should support this; I'm running the following:
  • Server info: Apache Tomcat/7.0.19
  • Servlet version: 3.0
  • JSP version: 2.1
  • Java version: 1.6.0_29


  • Has anyone been able to get the web.xml solution for this to work?

    Thanks
     
    Sheriff
    Posts: 67747
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I've never tried using it as I've never worried about the extra whitespace. But one reason might be that your URL pattern 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.
     
    jeff kies
    Greenhorn
    Posts: 5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    great suggestion - but no luck.

    I changed the url-pattern to:

    [code]
    <url-pattern>*.action</url-pattern>
    [\code]

    but it still didn't work. really good ide though.

    anyone else out there come across this?

     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic