bean class
Code: Select all
package pl.comfortel.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.event.ActionEvent;
@ManagedBean
@RequestScoped
public class Page {
boolean renderLink;
public boolean isRenderLink() {
return renderLink; }
public void setRenderLink(boolean renderLink) {
this.renderLink = renderLink; }
public Page(){}
public void actionMethod(ActionEvent e){
String a = "a"; }
public void setRenderLink(){
this.renderLink = true; }
}//end of Page
Code: Select all
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form id="form">
<p:commandLink action="#{page.setRenderLink}"
ajax="true"
update="form">
render link
</p:commandLink>
<p:ajaxStatus style="text-align: center;">
<f:facet name="start">
Loading...
</f:facet>
<f:facet name="error">
error
</f:facet>
<f:facet name="complete">
complete
</f:facet>
</p:ajaxStatus>
<p:commandLink actionListener="#{page.actionMethod}"
rendered="#{page.renderLink}" >
link
</p:commandLink>
</h:form>
</h:body>
</html>