0

下面是代码,

<h:panelGroup rendered="#{myBean.showDialogBox}"> //Boolean value from bean decides
//if Jquery Dialog box has to be shown or not for this User.

<script type="text/javascript">
/* <![CDATA[ */


   var $h=jQuery.noConflict();          
   function myFunction() 
   {

        $h(document).ready(function() {

            $h("#someDivID").dialog({

                // Dialog box attributes go here
        });
   }

   myFunction();  // Call myFunction to render Jquery Dialog box

/* ]]> */
</script>


<div id="someDivID"> //Below JSF component gets displayed inside Jquery Dialog box
    <h:commandLink value="Click Here" action="#{myBean.someMethod}"></h:commandLink>
</div>

</h:panelGroup>

问题: 如果我删除h:panelGroup,我的h:commandLink工作正常(调用 bean 方法)。但是,我无法删除h:panelGroup,因为此对话框必须根据预定义的条件仅向少数用户显示。我想rendered利用h:panelGroup.

我怎样才能解决这个问题?

4

2 回答 2

0

它可能是跨度问题中的 div。尝试在 h:panelGroup 中添加 layout="block" ,使其呈现为 div。

于 2013-04-13T12:43:27.493 回答
0

通过放置h:panelGroup刚刚解决它</script>

下面是代码,

<h:panelGroup rendered="#{myBean.showDialogBox}"> //Boolean value from bean decides
//if Jquery Dialog box has to be shown or not for this User.


<script type="text/javascript">
/* <![CDATA[ */


   var $h=jQuery.noConflict();          
   function myFunction() 
   {

        $h(document).ready(function() {

            $h("#someDivID").dialog({

                // Dialog box attributes go here
        });
   }

   myFunction();  // Call myFunction to render Jquery Dialog box

/* ]]> */
</script>

</h:panelGroup> // This is what was required

<div id="someDivID"> //Below JSF component gets displayed inside Jquery Dialog box
    <h:commandLink value="Click Here" action="#{myBean.someMethod}"></h:commandLink>
</div>

但是,如果有人可以解释这一点,将不胜感激。

于 2013-04-13T13:17:59.043 回答