Railo View Source has a few thousand blank lines

301 views Asked by At

I just noticed that when I view my source code in a browser, I have a few thousand blank lines before my actual code begins.

Is this a known issue in Railo? Or is there just a setting I'm missing somewhere?

I'm running Railo 4.0, on Ubuntu

2

There are 2 answers

1
JClausen On

In your Railo web administrator, you can turn on "Whitespace Management" in the "Output" settings page (e.g. yoursite.com/railo-context/admin/web.cfm?action=server.output ). It is disabled by default.

You can also use the <cfprocessingdirective suppresswhitespace="true"> setting to turn suppression on and off during the request.

0
Eccountable On

The reason for the blank lines is that when you write a CFML template, you are probably putting much of your <CF...> tags (queries and logic) before you write the output/HTML, and each line of code has a CR/LF after it which is rendered in the final output. If you have an Application.cfm (or cfc) file then all that code is also rendering whitespace before your .cfm page as well.

You can use the Whitespace Management feature in the administrator or you can wrap your entire page with a <CFProcessingdirective supresswhitespace="true"> tag, but you can also use the <cfscript> tag, or put your logic inside a <cffunction output="no"...> tag or even a <cfsilent> tag.

Personally, I am big fan of using CFComponent tags (inside a .cfc file) to encapsulate much of the code into "classes" and leave the .cfm files strictly for output rendering.