Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > [JSTL] empty strings inside table cells *with borders*

Reply
Thread Tools

[JSTL] empty strings inside table cells *with borders*

 
 
Karsten Wutzke
Guest
Posts: n/a
 
      10-28-2003
Hi all!

I am generating HTML with a lot of table content, that is in the <td>
tags. With my table cells, I always get empty cells with *no borders*
when <cut> ing the empty string (in Java: String str = ""

Is there any way get <td> cells *with borders* when <cut> ing the
empty string?

Karsten

 
Reply With Quote
 
 
 
 
VisionSet
Guest
Posts: n/a
 
      10-28-2003

"Karsten Wutzke" <kwutzke-> wrote in message
news:bnmc4e$32o$01$...
> Hi all!
>
> I am generating HTML with a lot of table content, that is in the <td>
> tags. With my table cells, I always get empty cells with *no borders*
> when <cut> ing the empty string (in Java: String str = ""
>
> Is there any way get <td> cells *with borders* when <cut> ing the
> empty string?
>


I think this is a browser issue, IE right?
<td></td> produces borderless cells in IE
fix is
<td>&nbsp;</td>
not sure when or if this has been fixed.

Try netscape to confirm.

--
Mike W


 
Reply With Quote
 
 
 
 
Karsten Wutzke
Guest
Posts: n/a
 
      10-28-2003


VisionSet wrote:

> "Karsten Wutzke" <kwutzke-> wrote in message
> news:bnmc4e$32o$01$...
>
>>Hi all!
>>
>>I am generating HTML with a lot of table content, that is in the <td>
>>tags. With my table cells, I always get empty cells with *no borders*
>>when <cut> ing the empty string (in Java: String str = ""
>>
>>Is there any way get <td> cells *with borders* when <cut> ing the
>>empty string?
>>

>
>
> I think this is a browser issue,


Could be. I have almost no HTML/browser experience.

> IE right?


Nope. Netscape 7.1.

> <td></td> produces borderless cells in IE
> fix is
> <td>&nbsp;</td>
> not sure when or if this has been fixed.
>
> Try netscape to confirm.
>


Hmmm. This insert a socalled non-breaking space to every cell...

I mostly pass String objects to JSTL. How can I query on a String object
from JSTL, whether it's the empty "" string? Like this, only &nsbp; will
be output if the string is empty ("").

The bad thing is, to use it for every cell, the text will shift to the
right one space, which looks uglier than before.

Any recommendations here?

Karsten

 
Reply With Quote
 
Christophe Vanfleteren
Guest
Posts: n/a
 
      10-28-2003
Karsten Wutzke wrote:
>
> I mostly pass String objects to JSTL. How can I query on a String object
> from JSTL, whether it's the empty "" string? Like this, only &nsbp; will
> be output if the string is empty ("").
>
> The bad thing is, to use it for every cell, the text will shift to the
> right one space, which looks uglier than before.
>
> Any recommendations here?
>
> Karsten


Just write a <c:if> tag that checks wether the String was emtpy/null and
writes a &nbsp; if that was the case.

I t might also be possible to force borders on your tablecells using css, so
you might want to check that in some html/css newsgroup.

--
Regards,
Christophe Vanfleteren
 
Reply With Quote
 
Karsten Wutzke
Guest
Posts: n/a
 
      10-28-2003


Christophe Vanfleteren wrote:

> Karsten Wutzke wrote:
>
>>I mostly pass String objects to JSTL. How can I query on a String object
>>from JSTL, whether it's the empty "" string? Like this, only &nsbp; will
>>be output if the string is empty ("").
>>
>>The bad thing is, to use it for every cell, the text will shift to the
>>right one space, which looks uglier than before.
>>
>>Any recommendations here?
>>
>>Karsten

>
>
> Just write a <c:if> tag that checks wether the String was emtpy/null and
> writes a &nbsp; if that was the case.
>
> I t might also be possible to force borders on your tablecells using css, so
> you might want to check that in some html/css newsgroup.
>


How exactly does a JSTL if look like, that can check for the empty string???

Thanks,
Karsten

 
Reply With Quote
 
VisionSet
Guest
Posts: n/a
 
      10-28-2003
"Karsten Wutzke" <kwutzke-> wrote in message
news:bnmnin$3op$06$...

>
> How exactly does a JSTL if look like, that can check for the empty

string???
>


<c:if test="${myString == empty}" >
<cut ....... />
</c:if>

--
Mike W


 
Reply With Quote
 
Karsten Wutzke
Guest
Posts: n/a
 
      10-28-2003


VisionSet wrote:

> "Karsten Wutzke" <kwutzke-> wrote in message
> news:bnmnin$3op$06$...
>
>
>>How exactly does a JSTL if look like, that can check for the empty

>
> string???
>
>
> <c:if test="${myString == empty}" >
> <cut ....... />
> </c:if>
>


Not quite... you probably meant something like:

<c:choose>
<c:when test="${empty cell.contents}">
&nbsp;
</c:when>
<ctherwise>
<cut value="${cell.contents}"/>
</ctherwise>
</c:choose>

Karsten

 
Reply With Quote
 
Bruce Lewis
Guest
Posts: n/a
 
      10-29-2003
Karsten Wutzke <kwutzke-> writes:

> VisionSet wrote:
>
> > "Karsten Wutzke" <kwutzke-> wrote in message
> > news:bnmnin$3op$06$...
> >
> >>How exactly does a JSTL if look like, that can check for the empty

> > string???
> > <c:if test="${myString == empty}" >
> > <cut ....... />
> > </c:if>
> >

>
> Not quite... you probably meant something like:
>
> <c:choose>
> <c:when test="${empty cell.contents}">
> &nbsp;
> </c:when>
> <ctherwise>
> <cut value="${cell.contents}"/>
> </ctherwise>
> </c:choose>


Is this seriously what you do in JSTL? In BRL I do

[(or (brl-nonblank? my-string) "&nbsp;")]
 
Reply With Quote
 
Christophe Vanfleteren
Guest
Posts: n/a
 
      10-29-2003
Bruce Lewis wrote:

> Karsten Wutzke <kwutzke-> writes:
>
>> VisionSet wrote:
>>
>> > "Karsten Wutzke" <kwutzke-> wrote in message
>> > news:bnmnin$3op$06$...
>> >
>> >>How exactly does a JSTL if look like, that can check for the empty
>> > string???
>> > <c:if test="${myString == empty}" >
>> > <cut ....... />
>> > </c:if>
>> >

>>
>> Not quite... you probably meant something like:
>>
>> <c:choose>
>> <c:when test="${empty cell.contents}">
>> &nbsp;
>> </c:when>
>> <ctherwise>
>> <cut value="${cell.contents}"/>
>> </ctherwise>
>> </c:choose>

>
> Is this seriously what you do in JSTL? In BRL I do
>
> [(or (brl-nonblank? my-string) "&nbsp;")]


It could be written a tad shorter.

<cut value="${cell.contents}"/>
<c:if test="${empty cell.contents}">
&nbsp;
</c:if>

In JSP 2 you can just write:

${cell.contents}
<c:if test="${empty cell.contents}">
&nbsp;
</c:if>

You could also make a custom tag like this:

<t:addSpaceIfEmpty value="${cell.contents}"/>

--
Regards,
Christophe Vanfleteren
 
Reply With Quote
 
Scott Yanoff
Guest
Posts: n/a
 
      10-31-2003
Karsten Wutzke wrote:
> Is there any way get <td> cells *with borders* when <cut> ing the
> empty string?


If the non-breaking space in those table cells makes your tables look
ugly, what about:

<cut value="${data}" default="&nbsp;" />

Doesn't the default signify what to put in case there is no value?


--
-Scott
| http://www.yanoff.org | AOL IM: SAY KJY

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Empty gridview cells and checking for empty string Savvoulidis Iordanis ASP .Net 1 09-05-2008 06:15 AM
Table with empty cells Luigi Donatello Asero HTML 2 09-04-2004 02:43 PM
anchor "names" in empty table cells James Mercola HTML 7 08-10-2004 02:20 AM
"opening" empty table cells Jeff Thies HTML 2 06-25-2004 09:59 AM
Re: width of table cells, table inside of form bbxrider HTML 0 07-14-2003 08:02 PM



Advertisments