Skip to Content
Former Member
Mar 29, 2010 at 06:56 AM

JSF Crystal report viewer component and parameters


My JSF Page Markup

    <bocrv:reportPageViewer reportSource="#{multiParam.getGetReport(param['reportId'])}" 

The Backing Bean

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

import javax.faces.context.FacesContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;

public class MultiParam {
    private static Log log = LogFactory.getLog(MultiParam.class);
    ReportingServiceImpl reportingService;

    public IReportSource getGetReport(String id) throws ReportSDKException, IOException, ServletException {
        log.debug("Report ID: " + id);
        String reportId;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false);
        if (session != null) {
            reportId = (String) session.getAttribute("reportId");
            if (StringUtils.isNotEmpty(reportId)) { //found in session
                return reportingService.getReportSource(reportId);
            } else if (StringUtils.isNotEmpty(id)) { // get from the request param
                session.setAttribute("reportId", id);
                return reportingService.getReportSource(id);
        return null;

Now When the JSF page is accessed the first time around It readily prompts for the parameter, But when The parameter is supplied and the ok button is pressed, the form is posted back to itself and the screen asking for parameter is being displayed again.

Can someone please guide me as to where am i going wrong with this...