You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by carmi_cd <ca...@yahoo.com> on 2007/11/05 02:17:31 UTC
[S2] ArrayList of Object as datasource in JasperReports
I need a tutorial that uses ArrayList of Object as datasource
for JasperReports..do you know any?
--
View this message in context: http://www.nabble.com/-S2--ArrayList-of-Object-as-datasource-in-JasperReports-tf4749173.html#a13580062
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] ArrayList of Object as datasource in JasperReports
Posted by carmi_cd <ca...@yahoo.com>.
here is the complete struts.xml
<struts>
<package name="apps" namespace="/apps"
extends="struts-default,jasperreports-default">
<!-- APPLICATION/GENERAL actions here -->
<action name="Logout" class="apps.Logout">
<result type="redirect-action">Login_input</result>
</action>
<action name="Menu" class="apps.Menu">
<result>/apps/Menu.jsp</result>
</action>
<!-- APPLICATION MODULE actions here -->
<action name="Toolbar" class="eis.module.Toolbar">
<result>/apps/modules/Toolbar.jsp</result>
</action>
<action name="Hrmis" class="eis.module.Hrmis">
<result name="error">/apps/SessionExpired.jsp</result>
<result>/apps/modules/Hrmis.jsp</result>
</action>
<action name="FNU" class="eis.module.FNU">
<result name="error">/apps/SessionExpired.jsp</result>
<result>/apps/modules/FNU.jsp</result>
</action>
<action name="Engineering" class="eis.module.Engineering">
<result name="error">/apps/SessionExpired.jsp</result>
<result>/apps/modules/Engineering.jsp</result>
</action>
<action name="UserMgt" class="eis.module.UserMgt" method="list">
<result name="success">/apps/modules/UserMgt/List.jsp</result>
<interceptor-ref name="basicStack"/>
</action>
<action name="UserMgt_*" class="eis.module.UserMgt" method="{1}">
<result name="success" type="redirect-action">UserMgt</result>
<result
name="input">/apps/modules/UserMgt/EntryForm.jsp</result>
<result name="error">/apps/modules/UserMgt/Error.jsp</result>
</action>
<action name="ReportGenerator" class="eis.report.ReportGenerator">
<result name="error">/apps/SessionExpired.jsp</result>
<result>/apps/reports/ReportGenerator.jsp</result>
</action>
<!-- REPORT FILTER FORM actions here -->
<action name="ReportFilterForm_*"
class="eis.report.ReportFilterForm_{1}">
<result>/apps/reports/ReportFilterForm_{1}.jsp</result>
</action>
<!-- REPORT actions here -->
<action name="EIS-HR-*" class="eis.report.EIS_HR_{1}">
<result name="error">/apps/reports/ReportNotFound.jsp</result>
<result>/apps/reports/EIS_HR_{1}.jsp</result>
</action>
<action name="EIS-FN-*" class="eis.report.EIS_FN_{1}">
<result name="error">/apps/reports/ReportNotFound.jsp</result>
<result>/apps/reports/EIS_FN_{1}.jsp</result>
</action>
<action name="EIS-EG-*" class="eis.report.EIS_EG_{1}">
<result name="error">/apps/reports/ReportNotFound.jsp</result>
<result>/apps/reports/EIS_EG_{1}.jsp</result>
</action>
<action name="EIS-HR-004_JASPER"
class="eis.report.EIS_HR_004_JASPER">
<result name="error">/apps/reports/ReportNotFound.jsp</result>
<result name="success" type="jasper">
apps/reports/templates/hr004.jasper
reportData
PDF
</result>
</action>
<!-- Add actions here -->
<action name="Login_*" method="{1}" class="apps.Login">
<result name="input">/apps/Login.jsp</result>
<result type="redirect-action">Home</result>
</action>
<action name="*" class="apps.eisSupport">
<result>/apps/{1}.jsp</result>
</action>
</package>
</struts>
please help me i've been thinking of it for a long time now..thanks again..
strutstwouser wrote:
>
> Can you paste the entire struts.xml ; ensure that you have :
>
> <package name="mypackage" extends="struts-default,jasperreports-default">
>
>
>
> On Nov 7, 2007 8:51 PM, carmi_cd <ca...@yahoo.com> wrote:
>
>>
>> hi actually i tried using that tutorial and got a pdf with no data in it
>> only
>> page and column titles.
>> i dont know why..
>>
>> Stacktrace of my sun application server, it has no problem. i dont know
>> why
>> the report is not filled with the data. here is my code:
>>
>> public class EIS_HR_004_JASPER extends eisSupport {
>> private String reportId;
>> private String dateStart = null;
>> private String dateEnd = null;
>> private String pdfFile;
>> private final static String _REPORT_FOLDER = "EIS_HR_003";
>> private Report thisReport;
>> private String dateRange;
>> private ArrayList<Personnel> reportData = new ArrayList<Personnel>();
>>
>> public String execute(ActionMapping mapping,ActionForm form,
>> HttpServletRequest request, HttpServletResponse response)
>> throws Exception {
>> ReportBean reportBean = new ReportBean();
>> setThisReport(reportBean.getReport(getReportId()));
>> setReportData();
>> try {
>> JasperCompileManager.compileReportToFile(
>> "apps/reports/templates/hr004.jrxml",
>> "apps/reports/templates/hr004.jasper");
>> } catch (Exception e) {
>> System.out.println("empty");
>> e.printStackTrace();
>> return ERROR;
>> }
>> return SUCCESS;
>> }
>>
>> public String getReportId() {
>> return reportId;
>> }
>>
>> public void setReportId(String reportId) {
>> this.reportId = reportId;
>> }
>>
>> public String getDateStart() {
>> if (this.dateStart == null || this.dateStart.equals("")) {
>> ResourceBundle eisProperty=ResourceBundle.getBundle("eis");
>> this.dateStart = eisProperty.getString("eis.minimum.date");
>> }
>> return this.dateStart;
>> }
>>
>> public void setDateStart(String dateStart) {
>> this.dateStart = dateStart;
>> }
>>
>> public String getDateEnd() {
>> if (this.dateEnd == null || this.dateEnd.equals("")) {
>> Calendar cal = Calendar.getInstance(TimeZone.getDefault());
>> this.dateEnd = (new SimpleDateFormat("MMM d,
>> yyyy").format(cal.getTime()));
>> }
>> return this.dateEnd;
>> }
>>
>> public void setDateEnd(String dateEnd) {
>> this.dateEnd = dateEnd;
>> }
>>
>> public String getPdfFile() {
>> //setPdfFile();
>> return pdfFile;
>> }
>>
>> public Report getThisReport() {
>> return thisReport;
>> }
>>
>> public void setThisReport(Report thisReport) {
>> this.thisReport = thisReport;
>> }
>>
>> public String getDateRange() {
>> setDateRange();
>> return dateRange;
>> }
>>
>> public void setDateRange() {
>> this.dateRange = "( " + getDateStart() + " - " + getDateEnd() + "
>> )";
>> }
>>
>> public ArrayList<Personnel> getReportData() {
>> // setReportData();
>> return reportData;
>> }
>>
>> public void setReportData() {
>> Personnel p1=new Personnel();
>> p1.setSurname("Dela Cruz");
>> p1.setFirstname("Juan");
>> p1.setExamcode("CSC111");
>> p1.setExamdate("January 1,2003");
>> Personnel p2=new Personnel();
>> p2.setSurname("Cruz");
>> p2.setFirstname("Miguel");
>> p2.setExamcode("CSC222");
>> p2.setExamdate("December 2,2003");
>> reportData.add(p1);
>> reportData.add(p2);
>> }
>>
>> }
>>
>> here is part of my struts.xml
>>
>> <action name="EIS-HR-004_JASPER" class="eis.report.EIS_HR_004_JASPER">
>> <result name="error">/apps/reports/ReportNotFound.jsp</result>
>> <result name="success" type="jasper">
>> apps/reports/templates/hr004.jasper
>> reportData
>> PDF
>> </result>
>> </action>
>>
>> i hope you could help me..thanks a lot.
>>
>>
>>
>>
>> strutstwouser wrote:
>> >
>> > http://struts.apache.org/2.x/docs/jasperreports-tutorial.html ; I was
>> able
>> > to use this as-is and get a report fine.
>> >
>> > -Joseph
>> >
>> >
>> > carmi_cd wrote:
>> >>
>> >>
>> >> I need a tutorial that uses ArrayList of Object as datasource
>> >> for JasperReports..do you know any?
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-S2--ArrayList-of-Object-as-datasource-in-JasperReports-tf4749173.html#a13639836
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
--
View this message in context: http://www.nabble.com/-S2--ArrayList-of-Object-as-datasource-in-JasperReports-tf4749173.html#a13659853
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] ArrayList of Object as datasource in JasperReports
Posted by j alex <st...@gmail.com>.
Can you paste the entire struts.xml ; ensure that you have :
<package name="mypackage" extends="struts-default,jasperreports-default">
On Nov 7, 2007 8:51 PM, carmi_cd <ca...@yahoo.com> wrote:
>
> hi actually i tried using that tutorial and got a pdf with no data in it
> only
> page and column titles.
> i dont know why..
>
> Stacktrace of my sun application server, it has no problem. i dont know
> why
> the report is not filled with the data. here is my code:
>
> public class EIS_HR_004_JASPER extends eisSupport {
> private String reportId;
> private String dateStart = null;
> private String dateEnd = null;
> private String pdfFile;
> private final static String _REPORT_FOLDER = "EIS_HR_003";
> private Report thisReport;
> private String dateRange;
> private ArrayList<Personnel> reportData = new ArrayList<Personnel>();
>
> public String execute(ActionMapping mapping,ActionForm form,
> HttpServletRequest request, HttpServletResponse response)
> throws Exception {
> ReportBean reportBean = new ReportBean();
> setThisReport(reportBean.getReport(getReportId()));
> setReportData();
> try {
> JasperCompileManager.compileReportToFile(
> "apps/reports/templates/hr004.jrxml",
> "apps/reports/templates/hr004.jasper");
> } catch (Exception e) {
> System.out.println("empty");
> e.printStackTrace();
> return ERROR;
> }
> return SUCCESS;
> }
>
> public String getReportId() {
> return reportId;
> }
>
> public void setReportId(String reportId) {
> this.reportId = reportId;
> }
>
> public String getDateStart() {
> if (this.dateStart == null || this.dateStart.equals("")) {
> ResourceBundle eisProperty=ResourceBundle.getBundle("eis");
> this.dateStart = eisProperty.getString("eis.minimum.date");
> }
> return this.dateStart;
> }
>
> public void setDateStart(String dateStart) {
> this.dateStart = dateStart;
> }
>
> public String getDateEnd() {
> if (this.dateEnd == null || this.dateEnd.equals("")) {
> Calendar cal = Calendar.getInstance(TimeZone.getDefault());
> this.dateEnd = (new SimpleDateFormat("MMM d,
> yyyy").format(cal.getTime()));
> }
> return this.dateEnd;
> }
>
> public void setDateEnd(String dateEnd) {
> this.dateEnd = dateEnd;
> }
>
> public String getPdfFile() {
> //setPdfFile();
> return pdfFile;
> }
>
> public Report getThisReport() {
> return thisReport;
> }
>
> public void setThisReport(Report thisReport) {
> this.thisReport = thisReport;
> }
>
> public String getDateRange() {
> setDateRange();
> return dateRange;
> }
>
> public void setDateRange() {
> this.dateRange = "( " + getDateStart() + " - " + getDateEnd() + "
> )";
> }
>
> public ArrayList<Personnel> getReportData() {
> // setReportData();
> return reportData;
> }
>
> public void setReportData() {
> Personnel p1=new Personnel();
> p1.setSurname("Dela Cruz");
> p1.setFirstname("Juan");
> p1.setExamcode("CSC111");
> p1.setExamdate("January 1,2003");
> Personnel p2=new Personnel();
> p2.setSurname("Cruz");
> p2.setFirstname("Miguel");
> p2.setExamcode("CSC222");
> p2.setExamdate("December 2,2003");
> reportData.add(p1);
> reportData.add(p2);
> }
>
> }
>
> here is part of my struts.xml
>
> <action name="EIS-HR-004_JASPER" class="eis.report.EIS_HR_004_JASPER">
> <result name="error">/apps/reports/ReportNotFound.jsp</result>
> <result name="success" type="jasper">
> apps/reports/templates/hr004.jasper
> reportData
> PDF
> </result>
> </action>
>
> i hope you could help me..thanks a lot.
>
>
>
>
> strutstwouser wrote:
> >
> > http://struts.apache.org/2.x/docs/jasperreports-tutorial.html ; I was
> able
> > to use this as-is and get a report fine.
> >
> > -Joseph
> >
> >
> > carmi_cd wrote:
> >>
> >>
> >> I need a tutorial that uses ArrayList of Object as datasource
> >> for JasperReports..do you know any?
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-S2--ArrayList-of-Object-as-datasource-in-JasperReports-tf4749173.html#a13639836
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: [S2] ArrayList of Object as datasource in JasperReports
Posted by carmi_cd <ca...@yahoo.com>.
hi actually i tried using that tutorial and got a pdf with no data in it only
page and column titles.
i dont know why..
Stacktrace of my sun application server, it has no problem. i dont know why
the report is not filled with the data. here is my code:
public class EIS_HR_004_JASPER extends eisSupport {
private String reportId;
private String dateStart = null;
private String dateEnd = null;
private String pdfFile;
private final static String _REPORT_FOLDER = "EIS_HR_003";
private Report thisReport;
private String dateRange;
private ArrayList<Personnel> reportData = new ArrayList<Personnel>();
public String execute(ActionMapping mapping,ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ReportBean reportBean = new ReportBean();
setThisReport(reportBean.getReport(getReportId()));
setReportData();
try {
JasperCompileManager.compileReportToFile(
"apps/reports/templates/hr004.jrxml",
"apps/reports/templates/hr004.jasper");
} catch (Exception e) {
System.out.println("empty");
e.printStackTrace();
return ERROR;
}
return SUCCESS;
}
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId;
}
public String getDateStart() {
if (this.dateStart == null || this.dateStart.equals("")) {
ResourceBundle eisProperty=ResourceBundle.getBundle("eis");
this.dateStart = eisProperty.getString("eis.minimum.date");
}
return this.dateStart;
}
public void setDateStart(String dateStart) {
this.dateStart = dateStart;
}
public String getDateEnd() {
if (this.dateEnd == null || this.dateEnd.equals("")) {
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
this.dateEnd = (new SimpleDateFormat("MMM d,
yyyy").format(cal.getTime()));
}
return this.dateEnd;
}
public void setDateEnd(String dateEnd) {
this.dateEnd = dateEnd;
}
public String getPdfFile() {
//setPdfFile();
return pdfFile;
}
public Report getThisReport() {
return thisReport;
}
public void setThisReport(Report thisReport) {
this.thisReport = thisReport;
}
public String getDateRange() {
setDateRange();
return dateRange;
}
public void setDateRange() {
this.dateRange = "( " + getDateStart() + " - " + getDateEnd() + "
)";
}
public ArrayList<Personnel> getReportData() {
// setReportData();
return reportData;
}
public void setReportData() {
Personnel p1=new Personnel();
p1.setSurname("Dela Cruz");
p1.setFirstname("Juan");
p1.setExamcode("CSC111");
p1.setExamdate("January 1,2003");
Personnel p2=new Personnel();
p2.setSurname("Cruz");
p2.setFirstname("Miguel");
p2.setExamcode("CSC222");
p2.setExamdate("December 2,2003");
reportData.add(p1);
reportData.add(p2);
}
}
here is part of my struts.xml
<action name="EIS-HR-004_JASPER" class="eis.report.EIS_HR_004_JASPER">
<result name="error">/apps/reports/ReportNotFound.jsp</result>
<result name="success" type="jasper">
apps/reports/templates/hr004.jasper
reportData
PDF
</result>
</action>
i hope you could help me..thanks a lot.
strutstwouser wrote:
>
> http://struts.apache.org/2.x/docs/jasperreports-tutorial.html ; I was able
> to use this as-is and get a report fine.
>
> -Joseph
>
>
> carmi_cd wrote:
>>
>>
>> I need a tutorial that uses ArrayList of Object as datasource
>> for JasperReports..do you know any?
>>
>
>
--
View this message in context: http://www.nabble.com/-S2--ArrayList-of-Object-as-datasource-in-JasperReports-tf4749173.html#a13639836
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] ArrayList of Object as datasource in JasperReports
Posted by strutstwouser <st...@gmail.com>.
http://struts.apache.org/2.x/docs/jasperreports-tutorial.html ; I was able to
use this as-is and get a report fine.
-Joseph
carmi_cd wrote:
>
>
> I need a tutorial that uses ArrayList of Object as datasource
> for JasperReports..do you know any?
>
--
View this message in context: http://www.nabble.com/-S2--ArrayList-of-Object-as-datasource-in-JasperReports-tf4749173.html#a13636526
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] ArrayList of Object as datasource in JasperReports
Posted by dasariprasad <dt...@gmail.com>.
file uploaded
prasad DTR
carmi_cd wrote:
>
>
> I need a tutorial that uses ArrayList of Object as datasource
> for JasperReports..do you know any?
>
http://www.nabble.com/file/p14590214/JasperReports-struts2.doc
JasperReports-struts2.doc
--
View this message in context: http://www.nabble.com/-S2--ArrayList-of-Object-as-datasource-in-JasperReports-tp13580062p14590214.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org