Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
This is version 27.
It is not the current version, and thus it cannot be edited. JasperReport on AppFuse - Putting JasperReports to work on AppFuse.About this TutorialThis tutorial will show you how to add a Controller to generate reports from AppFuse user account database.Table of Contents
Create the UserReportController Controller [#1]One of the forms to call a report is to implement a new controller. We go to use one of the great characteristic that Spring MVC possess, the possibility of implement/extend one of existing controllers - one in special, MultiActionController. For that we will create the UserReportController controller, which will extends from MultiActionController controller:
MultiActionController resolves method names based on a method name resolver. The default method name resolver is InternalPathMethodNameResolver, which resolves method names based on URL patterns. But Spring comes with two other method name resolvers:
Regardless of which method name resolver you choose, you’ll need to wire it into the methodNameResolver property of the MultiActionController to override the default. In the configuration file action-servlet.xml, makes the following modifications - we will use the first method to decide names:
The requests would be of the following form: /appfuse/userReport.html?action=userReport and thus for ahead, for each method that you add in the class userReportController. Another thing that we do not have to forget is to establish which URL will use to call this controller. As this URL is one of the administrative tasks, we will go to place this mapping in the Bean adminUrlMapping:
Now the most important, let's verify if everything is correct through the execution of the test of unit for this class. We already know that the current test will fail! This because we do not create our report and therefore we do not define who will resolve the name of the JasperReports's report file, userList.jrxml. Then, in the UserReportControllerTest tests class, we have to test the existence of view userReport with format pdf: to be continued Attachments:
|