Adding the report button for each view

Let's edit the product view first.

Your product_index.scala.html file should look something like this:

@(products:Seq[Product])(implicit flash: Flash)

@main("Products") {

// ... rest of the ui code ...

success">

Add Product

success">

Products Report

}

As you can see here, we added a new button pointing to the new report function. We will need to do the same for the review and the image UI. Your review_index.scala.html file should look something like this:

@(reviews:Seq[Review])(implicit flash: Flash)

@main("Reviews") {

// ... rest of the ui code ...

success">Add Review

success">Review Report

}

Now we can add the final button to the image view. Your image_index.scala.html file should look something like this:

@(images:Seq[Image])(implicit flash:Flash)

@main("Images") {

// ... rest of the ui template ...

"btn btn-success">Add Image

"btn btn-success">

Images Report

}

All set! Now we can run $ activator run and see the new UI and report buttons. Go to h

ttp://localhost:9000/:

If you go to http ://iocaihost :9000/reports, or click on Reports, you will see the following:

That's it! We have all the reports working on the Play framework application.

Summary

In this chapter, you learned how to create custom reports using Jaspersoft Studio and JasperReports. Additionally, you also changed your application in order to integrate the Play framework and JasperReports.

In the next chapter, you will learn how to use the Akka framework. We will continue building our application and embrace the actor model for a new killer feature for your application.

8

 
Source
< Prev   CONTENTS   Source   Next >