RE: OGNL expression help

2009-11-17 Thread Neil Aggarwal
> Doesn't help unfortunately as the > length of the string > in characters is not the same as the space required to > display it in full! Have you tried adding 2 or 3 to the length value? Neil -- Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net Host your struts app on a CentOS VP

Re: OGNL expression help

2009-11-17 Thread RogerV
Chris Pratt wrote: > > Like Neil suggested, use "attrib.length()" The extra parens cause OGNL to > call getAttrib().length() rather than getAttrib().getLength(). > (*Chris*) > Thanks, that does work in that the textfield re-sizes according to the length of the string. Doesn't help unfortun

RE: OGNL expression help

2009-11-16 Thread Neil Aggarwal
> Extending String? String is final so it isn't doable ;-) I did not check that. I see someone posted a better solution than this but I guess if someone wanted to have a getLength() for a String, they could write a container class that holds a String and then implement all the methods to call

Re: OGNL expression help

2009-11-16 Thread Lukasz Lenart
2009/11/16 Neil Aggarwal : > You could create your own MyString class that > extends String and then have a getLength() method > that calls super.length(). Extending String? String is final so it isn't doable ;-) Regards -- Lukasz http://www.lenart.org.pl/ -

Re: OGNL expression help

2009-11-16 Thread Chris Pratt
Like Neil suggested, use "attrib.length()" The extra parens cause OGNL to call getAttrib().length() rather than getAttrib().getLength(). (*Chris*) On Mon, Nov 16, 2009 at 8:08 AM, RogerV wrote: > > > > Kawczynski, David wrote: > > > > For this example pretend your field "firstname" has a max

RE: OGNL expression help

2009-11-16 Thread Neil Aggarwal
> length are related to the fact that the method call on a string is > String.length() not String.getLength and when I use > size="%{attrib.length}" > OGNL is trying to call getAttrib().getLength() on my action You could create your own MyString class that extends String and then have a getLengt

RE: OGNL expression help

2009-11-16 Thread RogerV
Kawczynski, David wrote: > > For this example pretend your field "firstname" has a max length of 15: > > LOL :) I suspect that my difficulties in trying to use OGNL to insert the length are related to the fact that the method call on a string is String.length() not String.getLength and when

RE: OGNL expression help

2009-11-16 Thread Neil Aggarwal
> > Could someone show me the correct way to insert a string > > field length into > > the size attribute of a element. > I think he was looking for something more involved, something like: I have not tested code to do this, so I don't know if that would work. Also, what if the myString

RE: OGNL expression help

2009-11-16 Thread Kawczynski, David
For this example pretend your field "firstname" has a max length of 15: > -Original Message- > From: RogerV [mailto:roger.var...@googlemail.com] > Sent: Monday, November 16, 2009 10:29 AM > To: user@struts.apache.org > Subject: OGNL expression help > > > Could someone show me the corr