8 Replies Latest reply on Feb 15, 2007 7:57 AM by laksu

    learning up

    laksu

      Hi,
      I am learning Seam and trying to build an app with simple small steps. I am trying something quite similar to Hotel Booking example. It is far plainer but I cannot seem to get it working.
      I have an entity bean called "Organization", a stateful session bean "OrganizationAction" and quite like the main.xhtml from the Booking example I usa an as in:

      <s:link id="viewItem" value="#{item.name}" action="#{organizationAction.selectOrganization(item)}" />

      and in selectOrganization method, I do assign it to the @Out marked member in the hope that it will show up in the next page.
       @In(required=false) @Out
       private Organization organization;
      
       @Begin
       public String selectOrganization(Organization selectedOrganization){
       System.out.println("Selected org:"+selectedOrganization.toString());
       organization = em.merge(selectedOrganization);
       return "organization";
       }
      


      It is almost identical (even less. i don't have ajax stuff) to the Booking example, like selecting the hotel from the list of hotels. Everything is parallel. But in the navigated organization.xhtml i cannot find the "organization" object outjected. Instead, a brand new instance of Organization is displayed.
      I must be missing something quite basic. I have tried and thrown anything into it to make it work and yet could not manage.
      Best regards,
      Levent


        • 1. Re: learning up
          laksu

          BTW, I am using Netbeans, Sun Java System Application Server and Seam 1.1.6

          • 2. Re: learning up
            shane.bryzak

            EL Params must exist in some scope. I'm guessing that item is a variable in a ui:repeat or something?

            • 3. Re: learning up
              laksu

              it is part of the table:


              <h:form id="zaba">
               <h:dataTable value="#{organizations}" var="item">
               <h:column>
               <f:facet name="header">No</f:facet>
               #{item.id}
               </h:column>
               <h:column>
               <f:facet name="header">Ad</f:facet>
               <s:link id="viewItem" value="#{item.name}" action="#{organizationAction.selectOrganization(item)}" />
               </h:column>
               <h:column>
               <f:facet name="header">
               <h:outputText value="Address"/>
               </f:facet>
               <h:outputText value="#{item.address}"/>
               </h:column>
               <h:column>
               <f:facet name="header">
               <h:outputText value="Deleted"/>
               </f:facet>
               <h:selectBooleanCheckbox value="#{item.deleted}" disabled="true" />
               </h:column>
               </h:dataTable>
               </h:form>


              it is passed to the method ok, so that i can see it in the log.

              • 4. Re: learning up

                Really? I don't believe that would work with s:link. It would work with h:commandLink.

                • 5. Re: learning up
                  gavin.king

                  It does work with s:link (I made it work).

                  • 6. Re: learning up

                    Hmm... I just tried it and it doesn't work for me with s:link. (the commandLink version does for me)

                    • 7. Re: learning up
                      gavin.king

                      Oh I misunderstood, it doesn't work because of the h:selectBooleanCheckbox.

                      • 8. Re: learning up
                        laksu

                        I cannot make neither of them work. I mean, the object is passed correctly but assigning it to the
                        @Out Organization organization does not outject it. I cannot see it in the upcoming page but a new instance of Organization

                        By the way, I realized that in the booking demo from Seam 1.0.1 passes the Hotel object "hot" differently than it is done in 1.1 demo. In 1.1 demo, hotel argument is passed by using an s:link and an argument to te selectHotel. Earlier demo uses @DataModelSelection and injects the HotelSearch into HotelBooking.

                        BTW, explanation pages below 1.1 demo is not updated and explains up to the old style.

                        Removing h:selectBooleanCheckbox does not make any difference. I changed everything up to the old style and tried passing the hotel with DataModelSelection. Also tried with commandLink.
                        I am confused a lot and I still cannot get the thing working right.