vishnukumar Posted August 19, 2009 Share Posted August 19, 2009 Hi, I am new to jasper reports. I am passing parameters as following. List<String> courseModules = new ArrayList<String>(); List<String> marks = new ArrayList<String>(); courseModules.add("Medical Billing"); courseModules.add("Medical Transcription"); marks.add("20"); marks.add("30"); Map model = new HashMap(); model.put("courseModules", courseModules); model.put(“marks”, marks); model.put("BaseDir", "reports"); model.put("JRDataSource", new JREmptyDataSource()); ModelAndView returnModelAndView = new ModelAndView("marksheet", model); I use ResourceBundleViewResolver. In .jrxml, I map parameters as <parameter name="courseModules" class="java.util.List"/> <parameter name="marks" class="java.util.List"/> I got printed as [Medical Billing, Medical Transcription][20, 30] But, my requirement is, I have to print like Courses MarkMedica Billing 30Medical Transcription 40 I don’t know how to iterate the elements in the list in jrxml.Please, guide me. ThanksVishnu Link to comment Share on other sites More sharing options...
teodord Posted August 21, 2009 Share Posted August 21, 2009 Hi, You could iterate though lists using a list component or a subreport. In JasperReports, iterating through something always implies a subdataset or a data source. I suggest you go with a list. Check the /demo/samples/list sample provided with the JR project package. You'll have to create a dataset that iterates though your list, probably using a build-in data source such as JRBeanCollectionDataSource or even a custom made data source implementation. Check the /demo/samples/datasource sample for details about custom data sources. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
pavitras Posted October 22, 2010 Share Posted October 22, 2010 Dear Vishnu, Could you achieve it ? I am also facing the exact problem but not able to solve it. Can you please share with me a sample jrxml file where you are iterating through a List (java.util.List) and printing the java bean attributes?A quick reply would be a great help.RegardsPavitra Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now