3 Replies Latest reply on Dec 16, 2009 3:27 AM by Ilya Shaikovsky

    Render problem of jsf 2.0

    Daniel Yang Novice

         I just want to rerender a tag(h:outputText) when I click one cell of a datatable using jsf 2.0, but my test showed me some error like that the tag id i set to be rerendered is not in the context of the cell tag.

           my code is following:



      <?xml version='1.0' encoding='UTF-8' ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
              <title>Facelet Title</title>
              <h:outputScript target="header" name="jquery.js" library="js"/>
              <script type="text/javascript">
      function showStatus(event) {
              <h:form id="form1" prependId="false">
                  <h:dataTable id="table" value="#{TestBean.allUsers}" var="u">
                          <f:facet name="header">
                              <h:outputLabel value="Name"/>
                          <h:outputLabel value="#{u.name}">
                              <f:ajax event="click" listener="#{TestBean.show(u)}" onevent="showStatus" render="out1"/>
              <h:outputText id="out1" value="#{TestBean.user.name}"/>
              <div id="status"></div>


      my test bean is:



      public class TestBean {
       private User user;
       private List<User> list;
          /** Creates a new instance of TestBean */
          public TestBean() {
       public List<User> getAllUsers(){
              list = new ArrayList<User>();
              for (int i = 0; i < 10; i++) {
                 list.add(new User("Name"+(i+1),18+i,"DV"+(i+1)));
              return list;
          public void show(User user){
              System.out.println("User nam is "+user.getName());
              this.user = user;
          public User getUser() {
              return user;
          public void setUser(User user) {
              this.user = user;

      <f:ajax event="click" listener="#{TestBean.show(u)}" onevent="showStatus" render="out1"/>

      The error appeared in this line.

      if I change render value to "@all" it works, but I just want to render the only one tag, why  must I set the render value "@all"?

      Any suggestions?

      Thanks in advance.