• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in iReport3.7.1 ,Struts2

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 .
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to Javaranch!

Have you tried converting the List to an Object[]?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And "mySource" is...?
 
Manali Mainkar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mySource : Arraylist in my action class
location : location of jasper
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And the report looks like...?

Please don't make me ask everything. TellTheDetails. ItDoesntWorkIsUseless.
 
Manali Mainkar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry.actually I am new to this site....
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic