http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jasper-howto.html#Configuration
When tomcar compiles the JSP it can have 'trimSpaces' turned on which will remove the whitespace between tags. I can think of other options like wrapping the tag in a string replacement tag like http://jakarta.apache.org/taglibs/doc/string-doc/index.html#replace
Or else you can write your tag like this:
string 1 <lib:tag attr="a"><lib:inside_tag attr2="b" /><lib:inside_tag attr2="c" /><lib:inside_tag attr2="d" /></lib:tag> string 2
which is ugly, or this
string 1
<lib:tag attr="a"
><lib:inside_tag attr2="b"
/><lib:inside_tag attr2="c"
/><lib:inside_tag attr2="d"
/></lib:tag>
string
Which is still a bit ugly, but more readable. The white space and newline is inside the tag so it won't appear in the output.
luca wrote:
Hallo, I hope this is the right group to ask TAG-lib related questions. Unfortunately, generic Java forums tend to be way too bad at answering this kind of questions.
I am implementing a tag-lib. One of the tags requires (or better allows) nested internal tags to better define the meaning of the top tag.
string 1 <lib:tag attr="a"> <lib:inside_tag attr2="b" /> <lib:inside_tag attr2="c" /> <lib:inside_tag attr2="d" /> </lib:tag> string 2
I have implemented this and it works. My only problem is that there are a bunch of carriage returns and white spaces in the output that I would like to avoid. In practice, I am getting this
-------------------------------------------------- string 1
tag output string2 -------------------------------------------------- while what I really want is:
-------------------------------------------------- string 1 tag output string2 --------------------------------------------------
since the internal tags only add info to the main tag and have no output per se.
Right now I am using
return(EVAL_BODY_INCLUDE);
at the end of the onStartTag() method....
Is there a way to tell the JSP engine to parse the tags but discard the output?
thank you
Luca
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Jason Lea
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]