I usually play with the tag delimiters to allow some readability. For example, my JSPs usually begin with something like:
<[EMAIL PROTECTED] contentType="..." import="..." import="..." errorPage="..." %><%!
// class code
%><%
// service code
%><!DOCTYPE ... > ...
And if I need to place two directives with no spaces in between, I write
<jsp:useBean id="data" scope="request" class="my.Data"
/><jsp:getProperty
name="data" property="aField"
/>
It is not as clean as a directive per line, but at least it doesn't hurt too much :-P
Regards, Rodrigo
Marius Scurtescu wrote:
Hi,
Yes, I totally agree that this issue should be brought up with the JSP specification. I will look into that.
Even if the suggestion is accepted it will be quite a while until a specification will deal with this issue and then even longer until there is going to be a Tomcat implementation supporting it. We are talking years I guess :-(
For what I know the specification is not saying anything about this issue and if Tomcat is implementing it right now it will not go against the spec.
Keeping strictly with the JSP directives (the issue can be extended to the JSP tags as well, but it gets more complicated) common sense is enough, I hope, to realize that whenever you add a directive you really don't want an empty line in your output. These empty lines are annoying at best (every time you check the source of a page generated by JSP you first see an empty page - quite stupid), and breaking your app at worst (like in the case of IE).
The absolute best proof that there is a problem here that needs fixing is the fact that developers make their code unreadable just as a work around.
Cheers, Marius
Rodrigo Ruiz wrote:
Marius, I think such a feature request should not be addressed to Tomcat, but to the JSP specification itself. Remember that Tomcat is being used as the reference implementation of servlet/JSP technologies, and so it should stick to the specification.
Basically, as I see it, your request means a special treatment for a subset of directives in a few specific cases. I think it would imply that tags could be marked as not generating any output, so when in a single JSP line there were only such marked tags and leading / trailing spaces among them, the line itself could be omited from the output. Such a change should be made from the specification.
Regards, Rodrigo
Marius Scurtescu wrote:
JSP is a templating language which is using a meta language: the JSP constructs.
The new line is in the JSP indeed, but is it part of the meta language or part of the literal output? I would argue that these new lines are part of the meta language and that they should not be output. You put them there so the meta language you use is readable.
See how FreeMarker, another templating language,
is dealing with this issue:
http://freemarker.sourceforge.net/docs/dgui_misc_whitespace.html#dgui_misc_whitespace_stripping
You are not asking the directive to scan anything, the page compiler could consider white space and newlines after a directive as part of that directive.
Marius
Adam Hardy wrote:
On 10/30/2003 10:08 PM Marius Scurtescu wrote:
I will consider implementing a filter to remove the empty lines before the <html> tag.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]