Clicking on commandLink is invoking preRenderView again

439 Views Asked by At

In my facelet, I have the below commandLink:

<h:form>
    <p:commandLink id="excelExport" action="#{studentBean.exportReport()}" ajax="false">
         <f:param name="type" value="EXCEL" />
         <p:graphicImage library="img" name="excel.png" width="20" />
    </p:commandLink>
</h:form>

This is what I am having in my backing bean:

@ManagedBean
@RequestScoped
public class StudentBean implements Serializable {
    .............
    @ManagedProperty(value = "#{param.type}")
    private String typeOfExport;

    .............
    public void preRender(ComponentSystemEvent event) {
        System.out.println("Inside prerender");
        if (FacesHelper.isAjaxRequest()) {
            return;
        }
    }
    .............
    public void exportReport() {
        System.out.println("Type of Report is: " + typeOfExport);
    }
}

Now I would like to execute the method exportReport once I click on the commandLink. But what is happening here is that after executing the method, it is going to preRender again. I don't want to render the entire form again. Any idea what mistake I am doing here?

0

There are 0 best solutions below