on 03-29-2010 7:56 AM
My JSF Page Markup
<h:form>
<bocrv:reportPageViewer reportSource="#{multiParam.getGetReport(param['reportId'])}"
allowParameterPrompting="true"/>
</h:form>
The Backing Bean
import com.crystaldecisions.sdk.occa.report.lib.ReportSDKException;
import com.crystaldecisions.sdk.occa.report.reportsource.IReportSource;
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;
import java.io.IOException;
@Name("multiParam")
public class MultiParam {
private static Log log = LogFactory.getLog(MultiParam.class);
@In
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...
Please bear with me I am new to Crystal reports.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In case someone is wondering my setup is the following... I am still thinking if a Crystal reports server would be required in this scenario or not.
+--------------+ +---------------------------------+
| Tomcat 6 ------- Some .rpt files deliverd to |
|--------------| | a folder via the CMS delivery |
|(JSF 1.2) | | channels |
|(JBOSS SEAM) | +---------------------------------+
|(FACELETS) |
|(Eclipse Cry |
| stal reports | +----------+
| plugin CR12) | | Or... |
| | | I use a |
| | | Crystal |
| | | Reports |
| | | Server |
| | +----------+
| |
| | I am really not sure if Crystal reports server
| | will be an ideal solution here.
+--------------+
I would appreciate any help in this or a shove in the right direction
The viewer - whether the JSPtag, JSF, or CrystalReportViewer class - all use postback for functionality.
What you're seeing is that the viewer isn't keeping state. You need to ensure the viewer - whichever you use - keeps the ReportSource in session state.
Because of all the different JSF implementations out there, where server-side or client-side session state persistence are handled slightly differently, you may instead want to use the CrystalReportViewer class instance directly, outside of JSF framework.
If so, I'd recommend reading the Viewer SDK Developer Guide for information.
Sincerely,
Ted Ueda
that was very helpful Ted...
Then how are people solving this problem as most of my reports are to be pretty complex (with drill downs and parameter prompting)...
I gave it a try here...but the backing bean sticks in the session and is not created afresh for a different report name parameter (I am picking the report name from a request parameter) as a result no new ReportSource is generated.
How are people solving this...as i don't see any other way than writing a jsf page and a backing bean per report...which entirely defeats the purpose of a CMS delivery channel of dumping the report files there.
Best Regards Ted...
Asif
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.