struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pratt <thechrispr...@gmail.com>
Subject Re: OGNL expression help
Date Mon, 16 Nov 2009 16:35:23 GMT
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 <roger.varley@googlemail.com> wrote:

>
>
>
> Kawczynski, David wrote:
> >
> > For this example pretend your field "firstname" has a max length of 15:
> > <s:textfield name="firstname" maxlength="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 I use size="%{attrib.length}"
> OGNL is trying to call getAttrib().getLength() on my action -which won't
> work.
>
> So, rephrasing slighly, how do I/can I use OGNL to call methods on
> attributes in my actions that do not follow the Bean pattern.
>
> Regards
>
> > -----Original Message-----
> > From: RogerV [mailto:roger.varley@googlemail.com]
> > Sent: Monday, November 16, 2009 10:29 AM
> > To: user@struts.apache.org
> > Subject: OGNL expression help
> >
> >
> > Could someone show me the correct way to insert a string
> > field length into
> > the size attribute of a <s:textfield> element.
> >
> > Regards
> > --
>
> --
> View this message in context:
> http://old.nabble.com/OGNL-expression-help-tp26373897p26374503.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message