You're using the same variable name for two different things:

 <t:selectItems
   var="seeker"

   <t:dataList
       var="seeker"

I wouldn't recommend doing this as it's only going to cause confusion
(even though they are both in different scopes).

I'm guessing the ordering problem is caused by how JSF 1.1
builds/renders a page.

The component does not exist until it's first rendered.

Ie,

build t:selectOneRadio.
render t:selectOneRadio.
build t:dataList
render t:dataList
build t:radio
render t:radio
build h:outputText
render h:outputText

JSF 1.1 with Facelets and JSF 1.2 solve this problem by always
building the full component tree, then rendering it.

The workaround in JSF 1.1 without facelets is to put the items you
need in an h:panelGroup which will force the children both to be built
before rendered (I think).  I know a similar trick is required to have
an h:outputLabel before the h:outputText.

So try this:

<h:panelGroup>
         <td>
           <t:radio
             for=":seekerSelectListSubview:selectSeekerForm:seekerSelection"
             index="#{rowIndex}" />
          </td>
          <td>
               <h:outputText value="#{seeker.displayName}" />
           </td>
</h:panelGroup>

Actually, you might have to put the panelGroup around the
t:selectOneRadio and and t:dataList.


On 6/5/07, Beelen, Marco <[EMAIL PROTECTED]> wrote:



Hello Mike,

Thanks for you suggestion.
Using a fully-qualified client-id does work indeed. It took some
trail-and-error to determine the proper path from the NamingContainer, but I
got a proper reference to the t:selectOneRadio for the t:radio-tag.

So I started to use the following code:

<t:selectOneRadio
    id="seekerSelection"
    layout="spread"
    value="#{createRequestBean.selectedSeeker}">

  <t:selectItems
    value="#{seekerSearchBean.seekers}"
    var="seeker"
    itemLabel=""
    itemValue="#{seeker}"
  />
</t:selectOneRadio>

<table>
    <t:dataList
        value="#{seekerSearchBean.seekers}"
        var="seeker"
        layout="simple"
        rowIndexVar="rowIndex">

        <tr>
          <td>
            <t:radio

for=":seekerSelectListSubview:selectSeekerForm:seekerSelection"
              index="#{rowIndex}" />
           </td>
           <td>
                <h:outputText value="#{seeker.displayName}" />
            </td>
          </tr>

        </t:dataList>
</table>


But then some other thing strange behaviour started to occur: The value of
the h:outputText becomes null if it is placed behind the t:radio tag.

This causes that the displayName the seeker doesn't get rendered, because
the method getDisplayName() of my Seeker-object doesn't get called.

If I change the order of the <h:outputText> and <t:radio> then the
displayName of the Seeker does get rendered in the first column and the
radio-button in the second, but that's not what I want in my user-interface.

I started to compare the rendering of the page with and without the
t:radio-tag.
In my debugger I started to follow what happens during the encodeChilderen()
of the HtmlListRenderer and I discover that the _requestMap of the
_externalContext of the ServletExternalContextImpl does NOT contain an entry
with the key "seeker" if the t:radio is on the page.
If I remove the t:radio and render the page again, then the entry for the
"seeker" IS present in the _requestMap.

I haven't been able to determine why the HtmlSelectOneRadio cause the
RequestAttribute to be remove / prevents it from being set.



Does anybody have any clue about how to get the working properly?

Any suggestions are greatly appreciated.

With kind regards,
  Marco Beelen






-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
Sent: vrijdag 1 juni 2007 16:30
To: MyFaces Discussion
Subject: Re: How to have the label of SelectOneRadio as a commandLink


Your idea of using t:radio was the first thought I had as well.  Maybe
if you specify the for as a fully-qualified client-id it will work.

If you don't want to hardcode this, one possibility is to bind the
selectOneRadio to a backing bean and fetch the clientid for that
component as the value binding of the t:radio for attribute.

On 6/1/07, Beelen, Marco <[EMAIL PROTECTED]> wrote:
>
>
>
> Hello all,
>
> I'm building an application and I don't know how to solve a certain GUI
> problem.
>
> Use case: The employee enters an request for a certain seeker ( = a
Customer
> )
>
> 1) The employee searches for the seeker based upon it's name.
> 2) The employee select the appropreate seeker from the resultset using a
> radio-button ( SelectOneRadio )
> 3) The employee starts to enter request information and continues…...
>
> This all goes well.
>
> Snippet from the page used in step 2:
>
> <h:selectOneRadio
>         layout="pageDirection"
>         value="#{createRequestBean.selectedSeeker}">
>
>         <t:selectItems
>                 value="#{seekerSearchBean.seekers}"
>                 var="seeker"
>                 itemLabel="#{seeker.displayName} / #{seeker.city}"
>                 itemValue="#{seeker}"
>         />
>
> </h:selectOneRadio>
>
> Now what I want to add is the possibilty to start editing the
> seeker-information for step to by allowing the employee to click on the
> label of the SelectItem, which navigation to an EditSeeker-page on which
the
> selected seeker will displayed.
>
> But I can't create a CommandLink or OutputLink as a part of the itemLabel
of
> the selectItems.
>
> Does any body have any suggestions for this?
>
> I was thinking about using the a combination of t:selectOneRadio with
> layout="spread", a t:dataList and t:updateActionListener like this:
>
> <t:selectOneRadio
>         id="seekerSelection"
>         layout="spread"
>         value="#{createRequestBean.selectedSeeker}">
>
>         <t:selectItems
>                 value="#{seekerSearchBean.seekers}"
>                 var="seeker"
>                 itemLabel=""
>                 itemValue="#{seeker}" />
>
> </t:selectOneRadio>
>
> <table>
>     <t:dataList
>         var="seeker"
>         value="#{seekerSearchBean.seekers}"
>         layout="simple"
>         rowIndexVar="rowIndex">
>
>         <tr>
>                 <td>
>                         <t:radio for="seekerSelection" index="#{rowIndex}"
> />
>
>                         <h:commandLink
> value="#seekerEditBean.startEditProcess">
>
>                                 <h:outputText
value="#{seeker.displayName} /
> #{seeker.city}}" />
>
>                                 <t:updateActionListener
>
property="#{seekerEditBean.seeker}"
>                                         value="#{seeker}"
/>
>
>                         </h:commandLink>
>                 </td>
>         </tr>
>
>     </t:dataList>
>
> </table>
>
>
> <h:commandButton
>         action="#{createRequestBean.selectBeneficiary}"
>         value="#{labels.btnNext}" />
>
>
> But that doesn't work, because it throws an IllegalStateException: Could
not
> find component 'seekerSelection' (calling findComponent on component
> 'beneficiarySelectList:selectSeekerForm:_id104:0:_id106')
>
> The component with id _id106 is the <t:radio for="seekerSelection" />
>
> Any suggestions will be greatly appreciated!
>
> With kind regards,
>   Marco Beelen
>
>
>
------------------------------------------------------------------------------
> Notice: This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
> New Jersey, USA 08889), and/or its affiliates (which may be known
> outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD
> and in Japan, as Banyu - direct contact information for affiliates is
> available at http://www.merck.com/contact/contacts.html)

> that may be
> confidential, proprietary copyrighted and/or legally privileged. It is
> intended solely for the use of the individual or entity named on this
> message. If you are not the intended recipient, and have received this
> message in error, please notify us immediately by reply e-mail and then
> delete it from your system.
>
>
------------------------------------------------------------------------------
>
>
>






------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD
and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html)
that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and then
delete it from your system.

------------------------------------------------------------------------------



Reply via email to