Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
A Beginner's Q: BIRT, JSP and JavaScript on the same page ?
LCypher
Hello,
I managed to create a JSP page with a form that runs JavaScript which cooks parameters that I'm passing to a BIRT Viewer tag on the same page. The problem is that this works when I specify the JSP page URI as the action attribute for the form but in that case upon submitting the form, the window is reloaded and all user's selections in the form are lost ( i.e. JavaScript overrides them whit initial values). What options do I have to display custom parameters form and a BIRT report within a same page, but without losing selected parameter values?
Regards!
Find more posts tagged with
Comments
JasonW
Can you post the JSP page?
LCypher
Here it is ...
JasonW
can you try something like:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/tlds/birt.tld" prefix="birt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<script>
function runReport(form){
alert(form.innerHTML);
form.submit();
}
</script>
<birt:parameterPage id="birtParmPage" reportDesign="TopNPercent.rptdesign"
name="my form"
pattern="frameset"
height="600"
width="800"
format="html"
title="My Viewer Tag"
isCustom="true"
showTitle="true"
showToolBar="true"
showNavigationBar="true"
>
TOP COUNT PARAMETER
<input type="Text" name="Top Count">
TOP PERCENT PARAMETER
<input type="Text" name="Top Percentage">
<input type="BUTTON" value="Run Report" OnClick="runReport(this.form)">
</birt:parameterPage>
</body>
</html>
LCypher
Sorry, can't get the point of the code above. Could you describe in few words what it's doing?
My understanding is: in order the <birt:report> ( or <birt:parameterPage) tags to be processed I have to reload the JSP page. When this happens user selected values in a form on the same page are reset. I'm thinking of using a java bean or the session implicit object to save user selections .... Please correct me if I'm wrong ...
JasonW
This function:
function runReport(form){
alert(form.innerHTML);
form.submit();
}
Is being called when the run report button is pressed. I can use it to validate parameters before the form is submitted. The JSP is not reloaded in this case.
Jason
LCypher
Hello,
this is what I did :
1) I created a separate JSP page with the <birt:report> tag
2) Run report button on the starting JSP page now calls a javascript function ( similar as in your example) which creates an Ajax request to the report JSP page passing all parameters ( I used prototype javascript framework )
3) Ajax response in then simply landed in a div tag on the primary JSP
I'm pretty sure that there are alternative and more optimal solutions to this simple problem so please share ....