Hi.. i followed the tutorial for JasperReport in the Struts 2
Documentation..my problem is the
code produces .jasper file but didnt return PDF on my browser but there is
no error message.
here is my code:
package apps;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JasperCompileManager;
import eis.model.HRStat;
import java.util.ArrayList;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
/**
*
* @author Administrator
*/
public class eis_hr_002 extends eisSupport{
//basic List - it will serve as our dataSource later on
/**
* Creates a new instance of eis_hr_002
*/
ArrayList myList;
public eis_hr_002() {
}
public String execute() throws Exception {
HrmisBean hrmisbean=new HrmisBean();
myList=hrmisbean.queryWS("2004-01-01","2007-12-01");
JasperReport jasperReport;
JasperPrint jasperPrint;
String
mypath="/opt/SDK/domains/domain1/applications/j2ee-modules/" +
"mypezaeis/apps/reports/";
try {
System.setProperty("jasper.reports.compile.class.path",
System.getProperty("java.class.path"));
JasperCompileManager.compileReportToFile(
mypath+"formats/hrmis1.jrxml",
mypath+"our_compiled_template.jasper");
} catch (Exception e) {
e.printStackTrace();
return ERROR;
}
//if all goes well ..
return SUCCESS;
}
/**
* @return Returns the myList.
*/
public List getMyList() {
return myList;
}
private String startdate;
public String getStartdate() {
return startdate;
}
public void setStartdate(String startdate) {
this.startdate = startdate;
}
private String enddate;
public String getEnddate() {
return enddate;
}
public void setEnddate(String enddate) {
this.enddate = enddate;
}
}
here is my struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="apps" namespace="/apps" extends="struts-default">
<result-types>
<result-type name="jasper"
class="org.apache.struts2.views.jasperreports.JasperReportsResult"/>
</result-types>
<action name="eis_hr_*" class="apps.eis_hr_{1}">
<result name="success" type="jasper">
/apps/reports/our_compiled_template.jasper
myList
PDF
</result>
</action>
<action name="Hrmis" class="apps.eis_hr_002">
<result name="error">/apps/SessionExpired.jsp</result>
<result>/apps/reportfilterform_002.jsp</result>
</action>
</package>
</struts>
i dont know why it generates a blank PDF without any data at all?
please help me..thanks in advance for your help
--
View this message in context:
http://www.nabble.com/JasperReports-in-Struts-2-tf3905309.html#a11072501
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]