Juan Diego
Juan Diego

Reputation: 1466

JSF show a p:dialog if a parameter is true

So what I want to do is quit simple. I have an page that displays a list of users, for example adminUsers.jsf, and it has a list of the users. I click the New User button and modal p:dialog shows with the user form.

This works perfect but what I want do is allowing my users to click on a link and the adminUsers.jsf shows with the p:dialog enabled.

So if a Users goes to the url

http://localhost:8080/pages/adminUser.jsf?create=true

the modal dialog is shown without clicking any extra button. I thought of a way of doing that but maybe it is not the proper JSF way. So this is what I am thinking. Capture the "create" on my userAdminController, and set an

<h:outputText/>

write some javascript to call userPanel.show, with a param like this.

rendered="#{usuarioAdminController.create}"

Is this the correct way of doing this.

Upvotes: 2

Views: 593

Answers (1)

kolossus
kolossus

Reputation: 20691

You can bind the value request parameter directly to the visible attribute of the dialog like this:

<p:dialog visible="#{param.create}"/>

Upvotes: 3

Related Questions