[
http://jira.jboss.com/jira/browse/JBSEAM-1733?page=comments#action_12370288 ]
Wise Guy commented on JBSEAM-1733:
----------------------------------
I think you mean the object returned by LocaleSelector.getSupportedLocales() is not
scoped. I know that and I know this will be the reason curLocale in my example cannot be
evaluated after the link is clicked.
What I wanted to note is that if someone wants to have variable evaluated to a literal
string and at the same time this variable should be used in a MethodBinding, these two are
impossible. Maybe my example was not good. Instead of:
#{localeSelector.selectLanguage(curLocale.value)}
I should've have noted it:
#{localeSelector.selectLanguage('#{curLocale.value}')}
So that one can easily see the syntax is wrong. You cannot both evaluate
#{curLocale.value} to "de" and pass
#{localeSelector.selectLanguage('de')} as MethodBinding. What you should do is
separately pass the variable as a request parameter (as the workaround stated). Yes, I
finally agree that the workaround is the best solution.
I wanted this cleared out for the users in the reference manual. I guess the discussions
made here and on the forum are already enough. If you don't want to include it there,
I'm ok with that.
Sorry for taking so much attention on this issue. As I stated this was not my intention. I
have great respect for your work. Please continue what you do best.
A limitation in the expression language enhancements is not
documented
----------------------------------------------------------------------
Key: JBSEAM-1733
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1733
Project: JBoss Seam
Issue Type: Task
Components: JSF, Documentation, EL
Reporter: Wise Guy
Priority: Minor
There is a limitation in the expression language enhancements that is not documented. It
would look like this:
---
http://docs.jboss.com/seam/2.0.0.B1/reference/en/html/elenhancements.html
Chapter 29. Expression language enhancements
29.1.2. Limitations
29.1.2.3. Cannot pass a variable to a MethodBinding
You may not pass a variable to a MethodBinding, hence the following syntax is not valid:
<ui:repeat var="curLocale"
value="#{localeSelector.supportedLocales}">
<s:link value="#{curLocale.label}"
action="#{localeSelector.selectLanguage(curLocale.value)}"/>
</ui:repeat>
Seam cannot evaluate "curLocale.value" in the rendering phase because it is a
part of a MethodBinding. If you need to do implement the same functionality then use the
f:param tag:
<s:link value="#{curLocale.label}"
action="#{localeProvider.updateLocale()}">
<f:param name="l" value="#{curLocale.value}"/>
</s:link>
Then, having the field variable "l" injected as a @RequestParameter, you would
do this:
public void updateLocale() {
if (l != null && l.length() > 0) {
localeSelector.selectLanguage(l);
}
}
--
May I also point out that you should merge "29.1. Parameterized Method
Bindings" and "29.2. Parameterized Value Bindings". (2.0.0.B1/reference)
Thank you for the attention
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira