]
Wise Guy commented on JBSEAM-1711:
----------------------------------
Two wrong solutions on a really "documented" feature request and it finally got
dumped :-\
The workaround (!? of a feature request) that I provided was in fact a really long way of
realizing the same functionality as the feature request. It cannot pass for a solution.
Allow variables to be passed into actions as parameters
-------------------------------------------------------
Key: JBSEAM-1711
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1711
Project: JBoss Seam
Issue Type: Feature Request
Components: JSF, EL
Affects Versions: 2.0.0.BETA1
Environment: Seam 2.0.0.BETA1, Facelets
Reporter: Wise Guy
Priority: Minor
There is a point missing in the enhancements made to the expression language. Because of
this, to me, they look more like a patch than a fully functional feature.
Seam allows to pass parameters to an action using EL:
<s:commandButton action="#{hotelBooking.bookHotel(hotel, user)}"
class="button" value="Book Hotel" />
Literal strings are also allowed:
<h:commandLink action="#{printer.println('Hello world!')}"
value="Hello"/>
This is all specified in:
Chapter 29. Expression language enhancements
29.1. Parameterized Method Bindings
http://docs.jboss.com/seam/2.0.0.B1/reference/en/html/elenhancements.html
This syntax, unfortunately, causes problems if you want to pass a variable created by
Facelets' repeat tag. This makes it harder to create links dynamically. Let me give
you the following example (same as the one in the JBoss Forum Reference):
<ui:repeat var="locale"
value="#{localeSelector.supportedLocales}">
<s:link value="#{locale.label}"
action="#{localeSelector.selectLanguage('#{locale.value}')}"/>
</ui:repeat>
You cannot have an expression inside an expression so the code for the action is not
valid. A workaround can be declared like this:
<ui:repeat var="locale"
value="#{localeSelector.supportedLocales}">
<s:link value="locale.value"
action="#{localeProvider.updateLocale()}">
<f:param name="l" value="#{locale.value}"/>
</s:link>
</ui:repeat>
public void updateLocale() {
if (l != null && l.length() > 0) {
localeSelector.selectLanguage(l);
}
}
I think that a simple syntax can be elaborated in which something similar to the original
idea can be used.
Maybe if we use the dollar ($) sign:
action="#{localeSelector.selectLanguage('${locale.value}')}"
this would make sense, maybe not (Unified EL has another task assigned to that sign). But
if the code is left like this, the url that is generated looks like this:
http://localhost:8080/WebApp/login.seam?cid=1&actionMethod=login.xhtm...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: