Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
544 views
in Technique[技术] by (71.8m points)

jsf 2 - How to hide and show p:panel on commandbutton click

i have the following problem:

I'm new to JSF2 and primefaces.

I have a table in a page that will be populated with information, after the user enters a string and clicks a CommandButton. After clicking the button, I want it to be disabled until processing is over.

To disable the CommandButton I'm doing the following;

<p:commandButton update=":outPanel" widgetVar="btnSend" id="btnsend"
     value="Calcular" actionListener="#{calcBean.getTrfs}" 
     onclick="btnSend.disable()" oncomplete="btnSend.enable()" />  

And then I have a panel where I want to show its contents:

<p:panel id="outPanel" widgetVar="outpanel">
         #{calcBean.result}
</p:panel>

How can I hide this outpanel when the page loads the first time?

How can I hide it when I click the CommandButton, and only show it again if the processing in my bean is successful?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Solved,

i have to put

   closable="true" toggleable="true" 

attributes in p:panel... Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

547k answers

4 comments

35.4k users

...