Spring MVC - Generate Excel Example. The following example shows how to generate Excel using the Spring Web MVC Framework. To begin with, let us have a working Eclipse IDE in place and stick to the following steps to develop a Dynamic Form based Web Application using the Spring Web Framework. Download the Apache POI library Apache POI.
- Spring MVC Basics
- Spring MVC - Form Handling
- Spring MVC - Form Tag library
- Spring MVC - Handler Mapping
- Spring MVC - Controller
- Spring MVC - View Resolver
- Spring MVC - Integration
- Spring Questions and Answers
- Spring Useful Resources
- Selected Reading
The following example shows how to generate Excel using the Spring Web MVC Framework. To begin with, let us have a working Eclipse IDE in place and stick to the following steps to develop a Dynamic Form based Web Application using the Spring Web Framework.
Step | Description |
---|---|
1 | Create a project with a name TestWeb under a package com.tutorialspoint as explained in the Spring MVC - Hello World chapter. |
2 | Create Java classes UserExcelView and ExcelController under the com.tutorialspoint package. |
3 | Download the Apache POI library Apache POI from the maven repository page. Put it in your CLASSPATH. |
4 | The final step is to create the content of the source and configuration files and export the application as explained below. |
ExcelController.java
UserExcelView.java
TestWeb-servlet.xml
views.xml
Here, we have created an ExcelController and an ExcelView. Apache POI library deals with Microsoft Office file formats and will convert the data to an excel document.
Login Form Using Spring Mvc And Hibernate
Once you are done with creating source and configuration files, export your application. Right click on your application, use Export → WAR File option and save the TestWeb.war file in Tomcat's webapps folder.
Download Excel Using Spring Mvc Flower Mound
Now, start the Tomcat server and make sure you are able to access other webpages from the webapps folder using a standard browser. Try a URL − http://localhost:8080/TestWeb/excel and we will see the following screen.