The new tertiary operator in JSP 2.0 may help clean this up.

<tr ${rowNum % 2 == 0 ? 'bgcolor="ffff99"' : ''}>

-----Original Message-----
From: Keith [mailto:[EMAIL PROTECTED]
Sent: Monday, May 03, 2004 12:12 PM
To: Tag Libraries Users List
Subject: Re: whitespace inside <c:choose> but outside <c:when> inserted
in to output


I've noticed that JSP never suppresses any whitespace at all outside the < > 
characters. 
I'm doing HTML output, so this doesn't effect me to much in the final output. Looking 
at 
my resulting HTML source sure is an eyesore, though. Especially when I use optional 
HTML 
attributes. Below is a snippet of code I use to make even numbered rows appear a 
different color:

<tr
        <c:if test="${rowNum % 2 == 0}"> bgcolor="ffff99"</c:if> 
>

The resulting <tr> tags look like this:

<tr
                 
        >

<tr
                 bgcolor="ffff99" 
        >


I have some that appears MUCH worse, too. No solution to it as far as I know, besides 
either having some really unreadable JSP source code or doing some additional parsing 
to 
get rid of it.

Keith

---------- Original Message -----------
From: Andreas Schildbach <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Mon, 03 May 2004 17:58:14 +0200
Subject: Re: whitespace inside <c:choose> but outside <c:when> inserted in to output

> Morrow, Steve D. wrote:
> 
> > I would have expected the space.
> 
> I thought there is no sense in putting any text between <c:choose> and 
> <c:when>. When should it show up?
> 
> Suppressing the whitespace at this point would ease indenting choose 
> constructs. If I want no whitespace at all, with the current 
> implementation I have to write the whole 
> choose/when/when/otherwise-construct in one line, which results in a 300 
> character line.
> 
> Regards,
> 
> Andreas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
------- End of Original Message -------


---------------------------------------------------------------------
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]

Reply via email to