0 Replies Latest reply on Apr 30, 2011 4:29 AM by oosnowan

    dynamic commandLink Problem

    oosnowan

      Hi, JBoss Users.

       

      I'm using JBoss 6.0 Final but have a very painful problem.

       

      A h:commandLink don't execute an action of backing bean when it is rendered by actioning, like action="#{testBB.showList}".

       

      In other words, First enter .../Test.xhtml into web brower address place.

      Second, click 'showList' link and system render 'showDetail'(name) Link of Test.xhtml.

      And then, I click 'showDetail' Link but JSF Engine don't execute TestBB.showDetail() method.

       

      please give me your know.

      Thanks.

       

      ========================= Below is my JSF and Backing Bean source code =====================

       

      -- Test.xhtml--

       

      <?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"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core" >
      <f:view>
      <h:head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

       

      <title>Test</title>
      </h:head>
      <h:body>

      <h:form id="testForm">

      <h:commandLink id="call" action="#{testBB.showList}">
      showList
      </h:commandLink>
      <table cellspacing="0" cellpadding="0" border="0" width="300">
      <thead>
      <tr>
        <th>name</th>
        <th>description</th>
      </tr>
      </thead>
      <tbody>
      <h:panelGroup rendered="#{testBB.requireShow}">
      <tr>
        <td>
         <h:commandLink id="testBtn" action="#{testBB.showDetail}">
          <h:outputText value="name1"/>
         </h:commandLink>
        </td>
        <td><h:outputText value="description1"/></td>
      </tr>
      </h:panelGroup>
      </tbody>
      </table>

      </h:form>

      </h:body>
      </f:view>
      </html>

       

       

      ---------------------------- TestBB.java ----------------------------

      package info.castingline.clms.test.web;

       

      import info.castingline.clms.test.biz.Testing;
      import info.castingline.clms.test.entity.Test;
      import info.castingline.framework.Logger;

      import javax.annotation.PostConstruct;
      import javax.ejb.EJB;
      import javax.faces.bean.ManagedBean;
      import javax.faces.bean.RequestScoped;


      @RequestScoped
      @ManagedBean
      public class TestBB {
      private Logger logger= Logger.getLogger(TestBB.class);
      @EJB Testing testing;

       

      private Test[] tests;

       

      private String iid;
      private String name;
      private String description;

       

      private boolean requireShow= false;

       

      public TestBB(){
       
      }

       

       

       

      public boolean isRequireShow() {
        return requireShow;
      }

       

      public void setRequireShow(boolean requireShow) {
        this.requireShow = requireShow;
      }

       

      public Test[] getTests() {
        return tests;
      }

       

      public void setTests(Test[] tests) {
        this.tests = tests;
      }

       

      @PostConstruct
          public void initialize(){
        logger.debug("initialize() is called!");
       
          }

       

      public String getIid() {
        return iid;
      }

       

      public void setIid(String iid) {
        this.iid = iid;
      }

       

      public String getName() {
        return name;
      }

       

      public void setName(String name) {
        this.name = name;
      }

       

      public String getDescription() {
        return description;
      }

       

      public void setDescription(String description) {
        this.description = description;
      }

      public String showList(){
        logger.debug("showList() is called!");
       
        tests= testing.findTests();
        requireShow= true;
        return "success";
      }

      public String showDetail(){
        logger.debug("showDetail() is called!");
       
       
        return "success";
      }

       

      }