• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to update commandlink from one page to other page?

 
Andrew Progash
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to update disabled attribute of commandlink from one page to other page but i don't know how to do it.

For example:
page1
<p:commandButton actionListener="#{MyBean.checkLogin()}" id="login" value="Login">
<p:ajax listener="#{MyBean.enableButton}" update="b1"/>
</p>


page2
<p:commandLink actionListener="#{MyBean.goStep1}" id="b1" disabled="#{!Mybean.enabled_back}"><button id="default" type="button">Back</button></p:commandLink>


if click button in page, set disabled attribute of button in page2 and go to page2.
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Change the name of MyBean to "myBean". POJO conventions are for Class names to begin uppercase, instance and property names begin with lowercase. Failure to observe this may cause various tools to malfunction.

2. Change #{MyBean.checkLogin()} to #{myBean.checkLogin}. The "()" is not appropriate here.

3. Change MyBean.checkLogin from an actionListener to a simple POJO action.

4. You cannot reference an element ID from any other View than the one that contains it. It doesn't matter, though, since when the second View is opened, the current backing bean values will apply.

Note that JSF does not support opening 2 windows/browser tabs at the same time. HTTP itself doesn't support 1 open window updating another one except as JavaScript permits. Then again, as a user, I don't like apps that open multiple windows. My desktop is crowded enough as it is.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic