This is a simpletons view here! I don't know how to write my own tags
& don't really want to (yet).

1 - Add a method getVeryLongName27() to your form bean which
truncates the long field. No scriplets or custom tags needed. Your
web page writer will probably want to specify the length of the
string so this is no good. However when people want shortened
versions of names I like the idea of methods like this so things are
truncated consistently. Maybe have a several getVeryLongNamenn()
methods where nn + 20, 27, 50, etc..

2 - in the jsp.
<% String limitedName =
myUtils.LimitString(formBean.getVeryLongName(), 50) %>
This lets the web page writer truncate however they want - but they
need a simple scriptlet.

3 - Another option is a special field on the database which has to be
entered by the user - called AbbreviatedVeryLongName, This must be
entered by the user but can default to the 1st 27 chars of the long
name.


hth - Keith.

--- Anna Englund <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I apologise if this question has already been
> discussed here, but I havn't been able to find any
> answere to my question. 
> 
> I'm currently working on a project using Struts, and
> we have identified many cases where we would like to
> shorten the output from a bean:write due to space
> limitations. Say for exaple that a method
> getVeryVeryLongName() on a bean book returns 100
> characters and the GUI only allows for 30 to be
> displayed (or else our web designer will be really mad
> ;-). I'd like to retrieve the 27 first characters from
> the getVeryVeryLongName() method and add ... Has
> anyone found a convinient way of doing this. I'm
> thinking that I might have to create a sub class to
> org.apache.struts.taglib.bean.WriteTag and override
> the doStartTag() method. Is this a good idea? Any
> other suggestions?
> 
> Any ideas (or working code ;-) would be welcome!
> Thanks,
> Anna
> 
> __________________________________________________
> Do You Yahoo!?
> Make a great connection at Yahoo! Personals.
> http://personals.yahoo.com


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

Reply via email to