You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by meeboo <de...@gmail.com> on 2007/04/27 16:02:27 UTC
question
Hey all
I am trying to populate the value of a s:textfield with some data from a
method via OGNL. I tried value="getTagsAsString(movie.id)" which doesn't
work at all (the textfield is populated with "getTagsAsString(movie.id)").
Then I tried the JSTL approach, by writing
value="%{#getTagsAsString(movie.id)}" but that doesn't return a result at
all. It seems as if the method getTagsAsString isn't called - shouldn't you
be able to do this via the value parameter of a s:textfield? I have pulled
it off before with s:property.
Thanks!
--
View this message in context: http://www.nabble.com/%3Cs%3Atextfield%3E-question-tf3657820.html#a10219702
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
Re: question
Posted by Dave Newton <ne...@yahoo.com>.
--- meeboo <de...@gmail.com> wrote:
> value="%{getTagsAsString(id)}" works like a charm.
> I'm still a bit confused on whether to use the #
> prefix or not in certain places, but i'm glad it
> works now :D
The # indicates non-root OGNL stack access.
When an Action is executed it's pushed on to the top
of the stack; no # to access its properties.
<s:iterator.../> pushes each consecutive value of its
collection on to the stack, so accessing it or one of
its properties does not require a #.
Conversely, *naming* each consecutive value using
<s:iterator.../>'s "id" attribute means you can access
the current object using the #name.property syntax (or
just #name if it has no properties or want the actual
object).
d.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: question
Posted by meeboo <de...@gmail.com>.
value="%{getTagsAsString(id)}" works like a charm. I'm still a bit confused
on whether to use the # prefix or not in certain places, but i'm glad it
works now :D
Thanks!
Felipe Rodrigues wrote:
>
> Well, when you're calling a method you should use %{} or #, otherwise it
> would print as a literal.
> I'm not sure about what of % or # will work.
>
>
> Dave Newton-4 wrote:
>>
>> --- meeboo <de...@gmail.com> wrote:
>>> But when I write <s:textfield
>>> value="getMovieCategory(category)"/> it
>>> only prints out "getMovieCategory(category)".
>>
>> Does %{getMovieCategory(category)} work?
>>
>> d.
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/%3Cs%3Atextfield%3E-question-tf3657820.html#a10222430
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
Re: question
Posted by Felipe Rodrigues <fe...@yahoo.com.br>.
Well, when you're calling a method you should use %{} or #, otherwise it
would print as a literal.
I'm not sure about what of % or # will work.
Dave Newton-4 wrote:
>
> --- meeboo <de...@gmail.com> wrote:
>> But when I write <s:textfield
>> value="getMovieCategory(category)"/> it
>> only prints out "getMovieCategory(category)".
>
> Does %{getMovieCategory(category)} work?
>
> d.
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/%3Cs%3Atextfield%3E-question-tf3657820.html#a10222125
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
Re: question
Posted by Dave Newton <ne...@yahoo.com>.
--- meeboo <de...@gmail.com> wrote:
> But when I write <s:textfield
> value="getMovieCategory(category)"/> it
> only prints out "getMovieCategory(category)".
Does %{getMovieCategory(category)} work?
d.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: question
Posted by meeboo <de...@gmail.com>.
I'm sure that it's on the stack. I am using another method call via OGNL
where I do <s:property value="getMovieCategory(category)"/> and that works
fine. But when I write <s:textfield value="getMovieCategory(category)"/> it
only prints out "getMovieCategory(category)". Is this expected behaviour or
a bug?
Thanks!
Felipe Rodrigues wrote:
>
> Is the method you're calling binded in some action that result in this
> form?
> I mean, to call some method by OGNL this method should be on the stack.
>
> Make sure it is on the stack, if it is and keeps not working, post the
> code of your action and your form here.
>
> Regards,
>
> Felipe
>
>
> meeboo wrote:
>>
>> Hey all
>>
>> I am trying to populate the value of a s:textfield with some data from a
>> method via OGNL. I tried value="getTagsAsString(movie.id)" which doesn't
>> work at all (the textfield is populated with
>> "getTagsAsString(movie.id)"). Then I tried the JSTL approach, by writing
>> value="%{#getTagsAsString(movie.id)}" but that doesn't return a result at
>> all. It seems as if the method getTagsAsString isn't called - shouldn't
>> you be able to do this via the value parameter of a s:textfield? I have
>> pulled it off before with s:property.
>>
>> Thanks!
>>
>
>
--
View this message in context: http://www.nabble.com/%3Cs%3Atextfield%3E-question-tf3657820.html#a10220153
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
Re: question
Posted by Felipe Rodrigues <fe...@yahoo.com.br>.
Is the method you're calling binded in some action that result in this form?
I mean, to call some method by OGNL this method should be on the stack.
Make sure it is on the stack, if it is and keeps not working, post the code
of your action and your form here.
Regards,
Felipe
meeboo wrote:
>
> Hey all
>
> I am trying to populate the value of a s:textfield with some data from a
> method via OGNL. I tried value="getTagsAsString(movie.id)" which doesn't
> work at all (the textfield is populated with "getTagsAsString(movie.id)").
> Then I tried the JSTL approach, by writing
> value="%{#getTagsAsString(movie.id)}" but that doesn't return a result at
> all. It seems as if the method getTagsAsString isn't called - shouldn't
> you be able to do this via the value parameter of a s:textfield? I have
> pulled it off before with s:property.
>
> Thanks!
>
--
View this message in context: http://www.nabble.com/%3Cs%3Atextfield%3E-question-tf3657820.html#a10220047
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