Re: Display only 100 chars of a string

2009-06-23 Thread Dave Newton
Stefano Tranquillini wrote: About this link: http://www.opensymphony.com/ognl/html/LanguageGuide/staticMethods.html said: You can call a static method using the syntax @cl...@method(args). If you leave out class, it defaults to java.lang.Math, to make it easier to call min and max methods. If yo

Re: Display only 100 chars of a string

2009-06-23 Thread Stefano Tranquillini
About this link: http://www.opensymphony.com/ognl/html/LanguageGuide/staticMethods.html said: You can call a static method using the syntax @cl...@method(args). If you leave out class, it defaults to java.lang.Math, to make it easier to call min and max methods. If you specify the class, you must

Re: Display only 100 chars of a string

2009-06-22 Thread Dave Newton
Wes Wannemacher wrote: No, Jon, you are right... This belongs in the action class. Just because OGNL lets you cheat doesn't mean you should (cue Dave jumping in any minute). Hey! I'm of two minds regarding this... Truncating a string is really a view-layer issue, handled (or instigated) by a

RE: Display only 100 chars of a string

2009-06-22 Thread Martin Gainty
t facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > From: stefano.tranquill...@gmail.com > Date: Mon, 22 Jun 2009 18:26:45 +0200 > Subject: Re: Display only 100 chars of a string > To: user@struts.apache.org > > are y

Re: Display only 100 chars of a string

2009-06-22 Thread Greg Lindholm
On Mon, Jun 22, 2009 at 12:07 PM, Stefano wrote: > @Greg: do u put that code inside the bean? i can't do this. > I put the abbreviate() method in the action class. It's actually in our 'base' action class so it's always available.

Re: Display only 100 chars of a string

2009-06-22 Thread Wes Wannemacher
On Mon, Jun 22, 2009 at 12:32 PM, Jon Pearson wrote: > I could be wrong... > > Honestly, you'd be better off adding a function to your action class > that would format a string to a specific length. It would be clearer > what was going on. Something like > > public String formatString(String s, int

RE: Display only 100 chars of a string

2009-06-22 Thread Jon Pearson
quot;; } } > -Original Message- > From: Stefano Tranquillini [mailto:stefano.tranquill...@gmail.com] > Sent: Monday, June 22, 2009 12:27 PM > To: Struts Users Mailing List > Subject: Re: Display only 100 chars of a string > > are you sure that this thing works? > beca

Re: Display only 100 chars of a string

2009-06-22 Thread Wes Wannemacher
On Mon, Jun 22, 2009 at 12:26 PM, Stefano Tranquillini wrote: > are you sure that this thing works? > because i don't see anything. > I'm inside an iterator , with this thing works   value="%{description}" /> with yours no. > seems that description is empty when i do value="@java.lang.str...@forma

Re: Display only 100 chars of a string

2009-06-22 Thread Stefano Tranquillini
double quotes, > here's a fix: > > > >> -Original Message- >> From: stefano.tranquill...@gmail.com >> [mailto:stefano.tranquill...@gmail.com] On Behalf Of Stefano >> Sent: Monday, June 22, 2009 12:07 PM >> To: Struts Users Mailing List >> Sub

RE: Display only 100 chars of a string

2009-06-22 Thread Jon Pearson
iling List > Subject: Re: Display only 100 chars of a string > > @Greg: do u put that code inside the bean? i can't do this. > @Jon thanks, but i've some problem with the " of the part: "%.100s" > the system found a end tag " at the first " that it

Re: Display only 100 chars of a string

2009-06-22 Thread Stefano Tranquillini
>> Sent: Monday, June 22, 2009 11:58 AM >> To: Struts Users Mailing List >> Subject: Re: Display only 100 chars of a string >> >> On Mon, Jun 22, 2009 at 17:46, Jon >> Pearson wrote: >> > String.format("%.100s", s); >> how can i put this thing in

Re: Display only 100 chars of a string

2009-06-22 Thread Stefano
>> Sent: Monday, June 22, 2009 11:58 AM >> To: Struts Users Mailing List >> Subject: Re: Display only 100 chars of a string >> >> On Mon, Jun 22, 2009 at 17:46, Jon >> Pearson wrote: >> > String.format("%.100s", s); >> how can i put this thing in

RE: Display only 100 chars of a string

2009-06-22 Thread Jon Pearson
sers Mailing List > Subject: Re: Display only 100 chars of a string > > On Mon, Jun 22, 2009 at 17:46, Jon > Pearson wrote: > > String.format("%.100s", s); > how can i put this thing in the jsp? > > > -- > Stefano > >

Re: Display only 100 chars of a string

2009-06-22 Thread Greg Lindholm
I have added an abbreviate() method to our base action class. /** * Abbreviate a string using ellipses (...). * If text is longer then len it is truncated to len characters then the * last 3 characters are replaced with ellipses (...). * * @param text the string to abb

Re: Display only 100 chars of a string

2009-06-22 Thread Stefano Tranquillini
On Mon, Jun 22, 2009 at 17:46, Jon Pearson wrote: > String.format("%.100s", s); how can i put this thing in the jsp? -- Stefano - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-

RE: Display only 100 chars of a string

2009-06-22 Thread Jon Pearson
h [mailto:avl...@gmail.com] > Sent: Monday, June 22, 2009 11:42 AM > To: Struts Users Mailing List > Subject: Re: Display only 100 chars of a string > > > > Cheers > Avlesh > > On Mon, Jun 22, 2009 at 9:07 PM, Stefano Tranquillini < > stefano.tranquill...@gmail.com

Re: Display only 100 chars of a string

2009-06-22 Thread Stefano Tranquillini
i found a solution: On Mon, Jun 22, 2009 at 17:40, Jim Kiley wrote: > This seems like the kind of thing that is crying out for a custom tag -- > and > I don't say that lightly. I mean, a scriptlet could do it, but scriptlets > are from the devil. A custom tag would be a better solution, espec

Re: Display only 100 chars of a string

2009-06-22 Thread Avlesh Singh
Cheers Avlesh On Mon, Jun 22, 2009 at 9:07 PM, Stefano Tranquillini < stefano.tranquill...@gmail.com> wrote: > Hi all. > there's a possibility inside a jsp to display only the first 100 chars > or the first 10 words of a string? > if i have a long string, can i display only the first 100 chars

Re: Display only 100 chars of a string

2009-06-22 Thread Jim Kiley
This seems like the kind of thing that is crying out for a custom tag -- and I don't say that lightly. I mean, a scriptlet could do it, but scriptlets are from the devil. A custom tag would be a better solution, especially since this is a pretty general problem. jk On Mon, Jun 22, 2009 at 11:37

Display only 100 chars of a string

2009-06-22 Thread Stefano Tranquillini
Hi all. there's a possibility inside a jsp to display only the first 100 chars or the first 10 words of a string? if i have a long string, can i display only the first 100 chars directly in a jsp without modification in action or something like that? thanks -- Stefano