File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes display string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "display string " Watch "display string " New topic

display string

prashant kond

Joined: Mar 03, 2005
Posts: 18
Our requirement to show only limited characters of the length of the string in UI page. I am using bean:write tag but which is displaying entire string. But I have to show only limited characters then suffixed that string with the dots.
If any one having idea on this would be appriciate.
Ud Naik

Joined: Jun 13, 2006
Posts: 18
Is the string only for display or do you need the value later for processing?

One way could be to extend the reset() method of the ActionForm, change the value of that string; in your case, truncate the string to whatever length you want and append dots to it.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'd suggest creating a second getter for the field. Example:

Then in your JSP, you code <bean:write name="myForm" property="truncatedString" />

Consultant, Sima Solutions
prashant kond

Joined: Mar 03, 2005
Posts: 18
thanks for the solution which you posted. It is working properly with the getter method.
I agree. Here's the link:
subject: display string
It's not a secret anymore!