[jbossseam-issues] [JBoss JIRA] Reopened: (JBSEAM-1711) Allow variables to be passed into actions as parameters

Wise Guy (JIRA) jira-events at lists.jboss.org
Tue Jul 24 09:55:04 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-1711?page=all ]

Wise Guy reopened JBSEAM-1711:
------------------------------

             
The proposed solution throws the following error:
Caused by javax.el.PropertyNotFoundException with message: "Property 'value' not found on type java.util.Locale"


I agree that I have not proposed all variations of invalid code that one can come up with. I have tested the code submitted by Gavin, the first time I ran my page. This code suggests that 'locale' is a seam component in some scope. This is not true. 'locale' is a variable and is available only for the current ui:repeat. When the methodbinding is executed in a following request this value cannot be accessed. It was coming from a rendering of the current request.

Please review my post again as I think you have not got my point.

Thank you.

PS Excuse me if my explanation if not stated clearly enough.

> 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.xhtml%3AlocaleSelector.selectLanguage%28%27%24%7Blocale.value%7D%27%29 

-- 
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

        



More information about the seam-issues mailing list