You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Isaac Mosquera <is...@worlddata.com> on 2004/07/26 20:14:59 UTC

format string with bean:write

I'm trying to only print the first TWELVE characters in a string with the 
tag <bean:write>, but i don't want to format the value inside the string, 
just the output,  how do i format the string to only show 12 characters 
using the tag?
-isaac 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: format string with bean:write

Posted by Brett Connor <br...@spamcop.net>.
bean:write has a format property. I haven't seen any documentation on 
what the format syntax is, but there's every chance it supports 
something along the lines of
AAAAAAAAAAAA.
Alternatively, create a derived property on your form bean and reference 
that, eg

class MyForm extends ActionForm {
  String getPropertyA() {
    return this.propertyA;
  }
  String getPropertyATwelve() {
    return this.propertyA.substring(0, 12);
  }
  ...


Isaac Mosquera wrote:

> I'm trying to only print the first TWELVE characters in a string with 
> the tag <bean:write>, but i don't want to format the value inside the 
> string, just the output,  how do i format the string to only show 12 
> characters using the tag?
> -isaac
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org