webtier@glassfish.java.net

Re: [webtier] JSF 2.0 PR <ui:repeat> Question

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Thu, 08 Jan 2009 08:53:49 -0800

Lincoln Baxter, III wrote:
> Here's another one for you. It's possible I am misusing ui:repeat, but
> I'm not sure.
>
> I'm trying to use a <ui:repeat> tag to generate the values for an
> <h:selectOneMenu>, but no values are rendered. The input list does
> contain values, because I am able to print them directly to the screen
> using <ui:repeat> (just a List of plain String objects)
>
> <h:selectOneMenu value="#{task.assignee}">
> <ui:repeat value="#{members}" var="member">
> <f:selectItem value="#{member}" />
> </ui:repeat>
> </h:selectOneMenu>
The thing about ui:repeat is that it does its thing during the render
response phase, so at the time the selectOneMenu is rendered
it has no UISelectItem children. If you used c:forEach here, that
would probably do what you want, however, in JSF 2.0, there is a better
solution:

<h:selectOneMenu value="#{task.assignee}">
    <f:selectItems value="#{members}"
                             var="member"
                             itemValue="#{member}"
</h:selectOneMenu>

Note that in this use case, #{members} returns some Collection of
generic objects and the select item generation is taken care of
for you.


>
> This results in an empty selectMenu. I also tried enclosing the
> ui:repeat in an f:subview, because I had heard that as a solution
> somewhere a while back, but to no avail.
>
> Note: I typed this by hand, so please forgive any syntax errors.
>
> Thanks,
> Lincoln
>
> On Wed, 2009-01-07 at 18:37 -0800, Jim Driscoll wrote:
>> Lincoln -
>>
>> I was able to reproduce this error (once), but unfortunately, it seems
>> to be intermittent, and I'm not able get it to happen again.
>>
>> I've filed a bug (#912).
>>
>> If you do see a hang again, please do the following:
>>
>> ps -ef | grep java
>>
>> to find the pid of the tomcat app.
>>
>> Then
>>
>> kill -QUIT tomcatpid
>>
>> Then, send us the stack trace that's in the catalina.out file.
>>
>> Again, thanks for reporting these problems. It's *very* helpful.
>>
>> Jim
>>
>> Lincoln Baxter, III wrote:
>> > Also, as I encounter with my other
>> > JSF2.0 projects, the server is unable to shutdown when running
>> > Mojarra2.0 PR or SNAPSHOT. It just hangs on "Stopping Coyote"
>> >
>> > Jan 6, 2009 7:33:49 PM org.apache.coyote.http11.Http11Protocol pause
>> > INFO: Pausing Coyote HTTP/1.1 on http-8081
>> > Jan 6, 2009 7:33:50 PM org.apache.catalina.core.StandardService stop
>> > INFO: Stopping service Catalina
>> > Jan 6, 2009 7:33:51 PM org.apache.coyote.http11.Http11Protocol destroy
>> > INFO: Stopping Coyote HTTP/1.1 on http-8081 *<--- hangs here*
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net <mailto:webtier-unsubscribe_at_glassfish.dev.java.net>
>> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net <mailto:webtier-help_at_glassfish.dev.java.net>
>>
>>