File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Problem in iReport3.7.1 ,Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Problem in iReport3.7.1 ,Struts2" Watch "Problem in iReport3.7.1 ,Struts2" New topic
Author

Problem in iReport3.7.1 ,Struts2

Manali Mainkar
Greenhorn

Joined: Mar 10, 2010
Posts: 7
Hello,
I am developing report in struts2 using jasper report.For report design I am using iReport3.7.1.
All VO class fiels are accessible with iReport along with the java.util.Arraylist contained in VO,but I am unable to access the fields of List.
Has anyone used the iReport with Sturts2 .
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Welcome to Javaranch!

Have you tried converting the List to an Object[]?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Isn't iReport just a jasperReports report designer? You don't really use it "with" Struts 2, you use the reports you designed.

In any case, yes, I created a bunch of reports using iReport and then used the JasperReports plugin to render them. I only did some of the work in iReport, though; too clunky to use. I never had any issues passing lists in (or arrays), if I remember correctly.
Manali Mainkar
Greenhorn

Joined: Mar 10, 2010
Posts: 7
ya...thats right ...its just the designer for jasper report . but while creating report ,it gives me fields,arraylist from my struts 2 vo class ,but I am not getting the solution for accesing the fields contain in my list .
Manali Mainkar
Greenhorn

Joined: Mar 10, 2010
Posts: 7
Hi!
My Object structure is like this...

StudentVO.java
int studentID;
String name;
Arraylist<SubjectVO> subjects;

& SubjectVO.java:
int subjectID;
String subjectName;
int marks;

I'm passing arraylist of StudentVO to report through Struts.xml
& I've attached object of StudentVO to dataset1 in ireport.
& then added all fields from that to report Fields.
After drag-dropping StudentID & name to page, I'm able to print ID & Name of student on page.
But just failing to populate arraylist of SubjectVO associated with that object on my page.

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're not really providing enough information to help. In any case, this sounds more like a JasperReports issue than a Struts 2 issue.

Without any info regarding the action config for the "jasper" result, or any info about the report, it's impossible to help.
Manali Mainkar
Greenhorn

Joined: Mar 10, 2010
Posts: 7
Hi ,
Actually I am passing DataSource,Location and Format as result params from struts.xml
<result name="success" type="jasper">
<param name="location">foo.jasper</param>
<param name="dataSource">mySource</param>
<param name="format">PDF</param>
</result>
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

And "mySource" is...?
Manali Mainkar
Greenhorn

Joined: Mar 10, 2010
Posts: 7
mySource : Arraylist in my action class
location : location of jasper
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

And the report looks like...?

Please don't make me ask everything. TellTheDetails. ItDoesntWorkIsUseless.
Manali Mainkar
Greenhorn

Joined: Mar 10, 2010
Posts: 7
My action
StudentVO studentVO = new StudentVO();
ArrayList<StudentVO> studentList= null;
SubjectVO vo = new SubjectVO ():
vo .setSubjectID(1);
vo.subjectName("English");
vo.setMarks(86) ;
Arraylist<SubjectVO> subjects = new Arraylist<SubjectVO>();
subjects .add(vo);
//StudentVo contais ArrayList<subjectVO>
studentVO .setStudentID(1);
studentVO .setName("StudentA");
studentVO.setSubjects (subjects) ;

//setting subjects ArrayList to StudentVO
studentList = new ArrayList<StudentVO>();

studentList .add(studentVO );
Passing studentList as dataSource from struts.xml
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read.

You can edit your post by using the button.

So show me the getter, and show me how you're accessing the data inside the report.
Manali Mainkar
Greenhorn

Joined: Mar 10, 2010
Posts: 7
sorry.actually I am new to this site....
 
 
subject: Problem in iReport3.7.1 ,Struts2
 
Similar Threads
struts2
Struts2
Struts2 java.lang.reflect.InvocationTargetException (Struts2 with Hibernate)
Jasper report integration
struts2