JFree Chart Via Java Programming

PIE Chart Using JFree Chart :
 
First required database connection, as per connection provide sql query to retrieve data from database. 
JDBCPieDataset dataset = new JDBCPieDataset(connection);
        try {
            dataset.executeQuery("SQL QUERY");
                    JFreeChart chart = ChartFactory.createPieChart
                    ("Performance - Report", dataset, true, true, false);
                    chart.setBorderPaint(Color.white);
                    chart.setBorderStroke(new BasicStroke(10.0f));
                    chart.setBorderVisible(true);
                    if (chart != null) {
                        int width = 500;
                        int height = 350;
                        final ChartRenderingInfo info = new ChartRenderingInfo (new StandardEntityCollection());
                        response.setContentType("image/png");
                        OutputStream out=response.getOutputStream();
                        ChartUtilities.writeChartAsJPEG(out, chart, width, height,info);
                    }
        }catch (SQLException e) {
            e.printStackTrace();
        }

Excel File Data Reading Using Spring MVC

 Uploading EXCEL - 2003, 2007 file's using file uploading UI, and insert all file data into database.

                            <form:form modelAttribute="bulkfileupload" role="form" enctype="multipart/form-data" >
                                            <div class="form-group">
                                                <label>Upload Excel File !</label>
                                                <form:input type="file" path="uploadFile" id="uploadFile"  />
                                                <div class="has-error">
                                                    <form:errors path="uploadFile" class="help-inline" />
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <input type="submit" value="upload">
                                            </div>
                                        </form:form>

For handling request of multipart/form-data, required MultipartResolver interface to handle file request. for that configure bean tage in xml file or

Path Variables In Spring Framework

Spring Framework offers to handle URI method parameters by using @PathVariable annotation

@Controller
@RequestMapping("admin")
public class PathVarController {

@RequestMapping("/welcome/{springPathVariable}/{page}")
public ModelAndView pathVariableTest(@PathVariable("page") String name, @PathVariable("springPathVariable") String pathVariable ) {

ModelAndView mav = new ModelAndView("pathVariable");
mav.addObject("message", " "+ name+" Your PathVariable is : "+pathVariable);
return mav;
}
}