4 Replies Latest reply on Oct 30, 2008 11:08 PM by Andrew Elegante

    Why i get null,when i use seam extended EL

    Wang Ruifeng Newbie


      <rich:dataTable id="userList"                       
          rendered="#{not empty userList.resultList}">
          <f:facet name="header">
              <h:outputText value="UserList"/>
              <rich:column sortBy="#{user.id}"> 
                      <f:facet name="header">
                              <h:outputText value="ID"/>
                      <h:outputText value="#{user.id}"/>
              <rich:column sortBy="#{user.name}"> 
                      <f:facet name="header">
                              <h:outputText value="Name"/>
                      <h:outputText value="#{user.name}"/>
                      <f:facet name="header"></f:facet>
                      <s:link view="/#{empty from ? 'User' : from}.xhtml" value="#{empty from ? 'Detail' : 'Select'}" id="user">
                              <f:param name="userId" value="#{user.id}"/>
                      <f:facet name="header"></f:facet>
                      <s:link id="deleteUser"      value="Delete" action="#{UserDelete.userDelete(user)}" />


      public class UserDeleteAction implements UserDelete {
          @Logger private Log log;
          @In FacesMessages facesMessages;
          public void userDelete(User user) {
                      log.info("UserId:" + user.getId());
                      log.info("UserName:" + user.getName());        

      When i click the delete link on UserList.xhtml
      I got:

      INFO  [UserDeleteAction] UserId:null
      INFO  [UserDeleteAction] UserName:null

      Why UserDelete.userDelete(user) can work?

        • 2. Re: Why i get null,when i use seam extended EL
          Wang Ruifeng Newbie

          But why in the booking example this code can work:

          <h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
                    <h:column id="column1">
                    <f:facet id="NameFacet"name="header">Name</f:facet>
               <h:column id="column2">
                    <f:facet id="AddressFacet" name="header">Address</f:facet>
               <h:column id="column3">
                    <f:facet id="CityStateFacet" name="header">City, State</f:facet>
                    #{hot.city}, #{hot.state}, #{hot.country}
               <h:column id="column4">
                    <f:facet id="ZipFacet" name="header">Zip</f:facet>
               <h:column id="column5">
                    <f:facet id="ActionFacet"name="header">Action</f:facet>
                    <s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>

          • 3. Re: Why i get null,when i use seam extended EL
            Manoj Agrawal Newbie

            Did you get the solution for your problem? I am also facing the same problem.

            • 4. Re: Why i get null,when i use seam extended EL
              Andrew Elegante Newbie

              The hotel booking models' backing bean exposes 'hot' via the @DataModelSelection annotation.  For your example, in your 'userList' bean you would ideally want to annotate the value returned by 'userList.resultList' with @DataModel and then have a field private User selectedUser annotated with @DataModelSelection.


                private List<User> searchResults;
                private User selectedUser;

              That should solve your user delete issue.  You should also change 'userList.resultList' to just reference your outjected data model i.e.

              <rich:dataTable id="userList"                       
                  rendered="#{not empty searchResults}">

              When you call


              seam injects the value of selectedUser into your 'user' variable.