和
隐藏/显示面板(hide/show the panel using
我是jsf和primefaces的新手。我想实现它,同时点击按钮两个链接应该启用,同时再次单击相同的按钮,两个链接被禁用。 我创建了一个使用<h:commandButton>和java bean隐藏show但不知道<p:commandButton>和<p:outputPanel>的示例。
我已经实现了这一点,点击链接将启用2链接。
问题是再次点击它必须被禁用,这是无效的
I am a new to jsf and primefaces.I want to implement that while clicking on button two link should be enable while clicking on the same button again that two link become disabled. I have created a example using <h:commandButton> and java bean to hide show but no idea with the <p:commandButton> and <p:outputPanel>.
I have achieved that while click on the link the 2 link will be enable.
Problem is but again clicking on that it has to be disable which was not working
最满意答案
如果我理解你:
<h:form id="mainform"> <p:commandButton value="#{testBean.enabled ? 'Hide' : 'Show'}" action="#{testBean.toggle()}" update="links, @this"/> <p:outputPanel id="links"> <p:link value="link1" href="http://www.stackoverflow.com" rendered="#{testBean.enabled}"/> <p:spacer width="10"/> <p:link value="link2" href="http://www.stackoverflow.com" rendered="#{testBean.enabled}"/> </p:outputPanel> </h:form>豆:
private Boolean enabled = false; // + getter/setter public void toggle() { enabled = !enabled; }If I understand you:
<h:form id="mainform"> <p:commandButton value="#{testBean.enabled ? 'Hide' : 'Show'}" action="#{testBean.toggle()}" update="links, @this"/> <p:outputPanel id="links"> <p:link value="link1" href="http://www.stackoverflow.com" rendered="#{testBean.enabled}"/> <p:spacer width="10"/> <p:link value="link2" href="http://www.stackoverflow.com" rendered="#{testBean.enabled}"/> </p:outputPanel> </h:form>Bean:
private Boolean enabled = false; // + getter/setter public void toggle() { enabled = !enabled; }更多推荐
commandButton>,link,电脑培训,计算机培训,IT培训"/> <meta name="descri
发布评论