Spartan Java

Tag: jstl

Long fields breaking your HTML?

by ricardoz on Apr.06, 2008, under Tips, Web related

I guess in more than one time you needed to display some text in a space where it not always will fit. For example graphical designers love to lay out lists and tables and purposely forget about how long each field will really be ;)

A solution I like is to display always a fixed number of characters and add the full text as a title (mouse over display). A really easy way to do this is using the substring function from the JSTL functions library, for example:

1
2
3
<span title="${myBean.myProp}">
${fn:substring(myBean.myProp,0,25)}
</span>
Leave a Comment :, , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...