0% found this document useful (0 votes)
429 views

Maven + JSF + RichFaces + JDBC + JXL API For Excel Export (Using Maven Project in Eclipse IDE)

This document provides instructions for setting up a Maven project in Eclipse that uses JSF, RichFaces, JDBC, and the JXL API for Excel export. It includes steps to create the Maven project structure with dependencies, configure the web.xml and faces-config.xml files, add managed beans and navigation rules. It also provides examples of classes for the database connection controller, application constants, and a transfer object to store query results.
Copyright
© Public Domain
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
429 views

Maven + JSF + RichFaces + JDBC + JXL API For Excel Export (Using Maven Project in Eclipse IDE)

This document provides instructions for setting up a Maven project in Eclipse that uses JSF, RichFaces, JDBC, and the JXL API for Excel export. It includes steps to create the Maven project structure with dependencies, configure the web.xml and faces-config.xml files, add managed beans and navigation rules. It also provides examples of classes for the database connection controller, application constants, and a transfer object to store query results.
Copyright
© Public Domain
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Maven + JSF + RichFaces + JDBC +

JXL API for Excel Export


(Using Maven Project in Eclipse IDE)

Create New Maven Project


Create a new simple Maven Project in Eclipse. You can search the docmentation for the same online.

Create pom.xml (replace XXXX with your desired value)


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.XXXX</groupId>
<artifactId>XXXX</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>XXXX</name>
<description>XXXX </description>
<properties>
<org.richfaces.bom.version>4.3.3.Final</org.richfaces.bom.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${org.richfaces.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.20</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/test/resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
<excludes>
<exclude>**/*local.properties</exclude>
</excludes>
</resource>
<resource>
<directory>src\main\resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.vm</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>src\main\webapp\WEB-INF</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>

<version>2.0</version>
<configuration>
<server>devserver</server>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>src\main\webapp\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project>

This should automatically start downloading maven jar files related to the
pom.xml entries. If not, then
1) right click on project from project explorer
2) select Run As -> Maven Install

web.xml (replace XXXX with your desired value)


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<description>XXXX</description>
<display-name>XXXX</display-name>
<context-param>
<param-name>com.sun.faces.sendPoweredByHeader</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.disableUnicodeEscaping</param-name>
<param-value>auto</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.externalizeJavaScript</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.resourceOptimization.enabled</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>blueSky</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.faces</welcome-file>
</welcome-file-list>
</web-app>

FacesServlet related Error


This step is a must to avoid javax.faces.webapp.FacesServlet related errors.
1) Right click on Project
2) Select Deployment Assembly
3) Add Maven Dependiencies directive

Maven Update, Clean and Install


1)
2)
3)
4)
5)
6)

Right click on Project from project explorer


Select Maven-> Update Project
Right click on project from project explorer
select Run As -> Maven Clean
Right click on project from project explorer
select Run As -> Maven Install

faces-config.xml (put your details at XXXX)


<faces-config version="2.1" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd">
<managed-bean>
<managed-bean-name>baseUIController</managed-bean-name>
<managed-bean-class>XXXX.ui.BaseUIController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

<managed-bean>
<managed-bean-name>dbConnectionController</managed-bean-name>
<managed-bean-class>XXXX.database.DbConnectionController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>registeredUsersUIController</managed-bean-name>
<managed-bean-class>XXXX.ui.RegisteredUsersUIController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>dbConnectionController</property-name>
<value>#{dbConnectionController}</value>
</managed-property>
</managed-bean>
<navigation-rule>
<navigation-case>
<from-outcome>index</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
<navigation-rule>
<navigation-case>
<from-outcome>registeredUsersReport</from-outcome>
<to-view-id>/registeredUsersReport.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
</faces-config>

DbConnectionController.java
It is always advisable to create a seperate controller class for storing database connection details. In entire project, only
this file should have hard coded database connection details so that in case of changing the connection details, only
one file needs to be modified.
package XXXX.database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class DbConnectionController {
Connection conn;
Statement stmt;
DriverManager driverManager;
public DbConnectionController() {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/DB_NAME", "DB_USER",
"DB_PASSWD");

stmt = conn.createStatement();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public Connection getConn() {
return conn;
}
public void setConn(Connection conn) {
this.conn = conn;
}
public Statement getStmt() {
return stmt;
}
public void setStmt(Statement stmt) {
this.stmt = stmt;
}
public DriverManager getDriverManager() {
return driverManager;
}

public void setDriverManager(DriverManager driverManager) {


this.driverManager = driverManager;
}

ApplicationConstants.java
Store standard error messages, file names etc in this file. Don't use file names anywhere in the project explicitely. This file
should be the only file where you should be able to update file names (apart from faces-config.xml)
package XXXX.constants;
public class ApplicationConstants {
public static final String ERROR_STRING = "There is some error executing the database query. Go to home page and
please try again.";
public static final String HOME_PAGE = "index";
public static final String REGISTERED_USERS = "registeredUsersReport";
}

public static final String REGISTERED_USERS_EXCEL = "registeredUsersReport.xls";

RegisteredUsersTO.java
Use a transfer object as resultset. This List of these objects will store the data retrieved from the database. This is a
standard coding practice.
package XXXX.resultsets;
import java.util.Date;
public class RegisteredUsersTO {
String firstName;
String lastName;
String emailAddress;
String addressLine1;
String addressLine2;
String country;
String state;
String city;
String pinCode;
Date dateOfBirth;
String gender;
/**
* @return the firstName
*/
public String getFirstName() {
return firstName;
}
/**
* @param firstName the firstName to set
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* @return the lastName
*/
public String getLastName() {
return lastName;
}
/**
* @param lastName the lastName to set
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* @return the emailAddress
*/
public String getEmailAddress() {
return emailAddress;
}
/**
* @param emailAddress the emailAddress to set
*/
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}

/**
* @return the addressLine1
*/
public String getAddressLine1() {
return addressLine1;
}
/**
* @param addressLine1 the addressLine1 to set
*/
public void setAddressLine1(String addressLine1) {
this.addressLine1 = addressLine1;
}
/**
* @return the addressLine2
*/
public String getAddressLine2() {
return addressLine2;
}
/**
* @param addressLine2 the addressLine2 to set
*/
public void setAddressLine2(String addressLine2) {
this.addressLine2 = addressLine2;
}
/**
* @return the country
*/
public String getCountry() {
return country;
}
/**
* @param country the country to set
*/
public void setCountry(String country) {
this.country = country;
}
/**
* @return the state
*/
public String getState() {
return state;
}
/**
* @param state the state to set
*/
public void setState(String state) {
this.state = state;
}
/**
* @return the city
*/
public String getCity() {
return city;
}
/**
* @param city the city to set
*/
public void setCity(String city) {
this.city = city;
}
/**
* @return the pinCode

*/
public String getPinCode() {
return pinCode;
}
/**
* @param pinCode the pinCode to set
*/
public void setPinCode(String pinCode) {
this.pinCode = pinCode;
}
/**
* @return the dateOfBirth
*/
public Date getDateOfBirth() {
return dateOfBirth;
}
/**
* @param dateOfBirth the dateOfBirth to set
*/
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
/**
* @return the gender
*/
public String getGender() {
return gender;
}
/**
* @param gender the gender to set
*/
public void setGender(String gender) {
this.gender = gender;
}

BaseUIController.java
You can store all common methods/procedures which all controller classes will access under this class. Controller classes
will inherit this class.
package XXXX.ui;
import java.io.Serializable;
import javax.faces.context.FacesContext;
public class BaseUIController implements Serializable {
private static final long serialVersionUID = 1L;
private static final String appVersion = "1.0";
public String getRealFileStoragePath() {
return FacesContext.getCurrentInstance().getExternalContext()
.getRealPath("/");
}
}

RegisteredUsersUIController.java
package XXXX.ui;
import
import
import
import
import

java.io.File;
java.sql.ResultSet;
java.util.ArrayList;
java.util.List;
java.util.Locale;

import javax.faces.application.FacesMessage;
import
import
import
import
import
import
import
import

jxl.Workbook;
jxl.WorkbookSettings;
jxl.write.Label;
jxl.write.WritableSheet;
jxl.write.WritableWorkbook;
XXXX.constants.ApplicationConstants;
XXXX.database.DbConnectionController;
XXXX.resultsets.RegisteredUsersTO;

public class RegisteredUsersUIController extends BaseUIController {


private static final long serialVersionUID = 1L;
List<RegisteredUsersTO> registeredUsersTOList;
DbConnectionController dbConnectionController;
ResultSet resultSet;
String excelFile;
public String getRegisteredUsers()
{
dbConnectionController = new DbConnectionController();
this.registeredUsersTOList = new ArrayList<RegisteredUsersTO>();
String query = "SELECT FIRST_NAME, LAST_NAME, EMAIL_ADDRESS, ADDR_LINE_1, ADDR_LINE_2,"
+ " PIN_CODE, CITY_NAME, STATE_NAME, COUNTRY_NAME, DATE_OF_BIRTH, GENDER"
+ " FROM USER INNER JOIN USER_DETAILS ON USER.USER_ID=USER_DETAILS.USER_ID"
+ " INNER JOIN COUNTRY ON USER_DETAILS.COUNTRY_CODE=COUNTRY.COUNTRY_CODE";
try {
resultSet = dbConnectionController.getStmt().executeQuery(query);
while (resultSet.next()) {
RegisteredUsersTO registeredUsersTO = new RegisteredUsersTO();
registeredUsersTO.setFirstName(resultSet
.getString("FIRST_NAME"));
registeredUsersTO.setLastName(resultSet
.getString("LAST_NAME"));
registeredUsersTO.setEmailAddress(resultSet
.getString("EMAIL_ADDRESS"));
registeredUsersTO.setAddressLine1(resultSet
.getString("ADDR_LINE_1"));
registeredUsersTO.setAddressLine2(resultSet
.getString("ADDR_LINE_2"));
registeredUsersTO.setPinCode(resultSet
.getString("PIN_CODE"));
registeredUsersTO.setCity(resultSet
.getString("CITY_NAME"));
registeredUsersTO.setState(resultSet

.getString("STATE_NAME"));
registeredUsersTO.setCountry(resultSet
.getString("COUNTRY_NAME"));
registeredUsersTO.setDateOfBirth(resultSet
.getDate("DATE_OF_BIRTH"));
registeredUsersTO.setGender(resultSet
.getString("GENDER"));
registeredUsersTOList.add(registeredUsersTO);
}
this.excelFile = ApplicationConstants.REGISTERED_USERS_EXCEL;
exportToExcel();
return ApplicationConstants.REGISTERED_USERS;
} catch (Exception e) {
addFacesMessage(FacesMessage.SEVERITY_ERROR,
ApplicationConstants.ERROR_STRING);
e.printStackTrace();
return null;
}
}
public void exportToExcel() {
try {
File file = new File(getRealFileStoragePath() + excelFile);
int rowcntr = 2;
WorkbookSettings wbSettings = new WorkbookSettings();
wbSettings.setLocale(new Locale("en", "EN"));
WritableWorkbook workbook = Workbook.createWorkbook(file,
wbSettings);
workbook.createSheet(
"Registered Users",
0);
WritableSheet excelSheet = workbook.getSheet(0);
excelSheet.addCell(new Label(0, 1, "FIRST NAME"));
excelSheet.addCell(new Label(1, 1, "LAST NAME"));
excelSheet.addCell(new Label(2, 1, "EMAIL ADDRESS"));
excelSheet.addCell(new Label(3, 1, "ADDRESS LINE 1"));
excelSheet.addCell(new Label(4, 1, "ADDRESS LINE 2"));
excelSheet.addCell(new Label(5, 1, "PIN CODE"));
excelSheet.addCell(new Label(6, 1, "CITY"));
excelSheet.addCell(new Label(7, 1, "STATE"));
excelSheet.addCell(new Label(8, 1, "COUNTRY"));
excelSheet.addCell(new Label(9, 1, "DATE OF BIRTH"));
excelSheet.addCell(new Label(10, 1, "GENDER"));
for (RegisteredUsersTO registeredUsersTO : registeredUsersTOList) {
excelSheet.addCell(new
excelSheet.addCell(new
excelSheet.addCell(new
excelSheet.addCell(new
excelSheet.addCell(new
excelSheet.addCell(new
excelSheet.addCell(new
excelSheet.addCell(new
excelSheet.addCell(new
excelSheet.addCell(new

Label(0,
Label(1,
Label(2,
Label(3,
Label(4,
Label(5,
Label(6,
Label(7,
Label(8,
Label(9,

rowcntr,
rowcntr,
rowcntr,
rowcntr,
rowcntr,
rowcntr,
rowcntr,
rowcntr,
rowcntr,
rowcntr,

registeredUsersTO.getFirstName()));
registeredUsersTO.getLastName()));
registeredUsersTO.getEmailAddress()));
registeredUsersTO.getAddressLine1()));
registeredUsersTO.getAddressLine2()));
registeredUsersTO.getPinCode()));
registeredUsersTO.getCity()));
registeredUsersTO.getState()));
registeredUsersTO.getCountry()));
String.valueOf(registeredUsersTO.getDateOfBirth())));

excelSheet.addCell(new Label(10, rowcntr, registeredUsersTO.getGender()));


rowcntr++;
}
workbook.write();
workbook.close();
} catch (Exception e) {
e.printStackTrace();
addFacesMessage(FacesMessage.SEVERITY_ERROR,
ApplicationConstants.ERROR_STRING);
}
}
public String goToHome() {
try {
resultSet.close();
dbConnectionController.setStmt(null);
dbConnectionController.setConn(null);
dbConnectionController = null;
this.registeredUsersTOList = null;
this.resultSet = null;
this.excelFile = null;
return ApplicationConstants.HOME_PAGE;
} catch (Exception e) {
addFacesMessage(FacesMessage.SEVERITY_ERROR,
ApplicationConstants.ERROR_STRING);
return null;
}
}
/**
* @return the registeredUsersTOList
*/
public List<RegisteredUsersTO> getRegisteredUsersTOList() {
return registeredUsersTOList;
}
/**
* @param registeredUsersTOList the registeredUsersTOList to set
*/
public void setRegisteredUsersTOList(
List<RegisteredUsersTO> registeredUsersTOList) {
this.registeredUsersTOList = registeredUsersTOList;
}
/**
* @return the dbConnectionController
*/
public DbConnectionController getDbConnectionController() {
return dbConnectionController;
}
/**
* @param dbConnectionController the dbConnectionController to set
*/
public void setDbConnectionController(
DbConnectionController dbConnectionController) {
this.dbConnectionController = dbConnectionController;
}
/**
* @return the resultSet

*/
public ResultSet getResultSet() {
return resultSet;
}
/**
* @param resultSet the resultSet to set
*/
public void setResultSet(ResultSet resultSet) {
this.resultSet = resultSet;
}
/**
* @return the excelFile
*/
public String getExcelFile() {
return excelFile;
}
/**
* @param excelFile the excelFile to set
*/
public void setExcelFile(String excelFile) {
this.excelFile = excelFile;
}

registeredUsersReport.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:form>
<div style="float: left; margin-left: 235px; margin-bottom: 5px;">
<br /> <br />
<h2>List of Registered Users of Website</h2>
<rich:dataTable id="registeredUsersDataTable" var="registeredUsrs"
style="width:960px;" rows="20"
value="#{registeredUsersUIController.registeredUsersTOList}"
rendered="#{not empty registeredUsersUIController.registeredUsersTOList}">
<f:facet name="header">
<rich:columnGroup>
<rich:column>
<h:outputText value="Name" />
</rich:column>
<rich:column>
<h:outputText value="Email Address" />
</rich:column>
<rich:column>
<h:outputText value="Complete Address" />
</rich:column>
<rich:column>

<h:outputText value="Country" />


</rich:column>
<rich:column>
<h:outputText value="Date of Birth" />
</rich:column>
<rich:column>
<h:outputText value="Gender" />
</rich:column>
</rich:columnGroup>
</f:facet>

<rich:column>
<h:outputText
value="#{registeredUsrs.firstName} #{registeredUsrs.lastName}" />
</rich:column>
<rich:column>
<h:outputText value="#{registeredUsrs.emailAddress}" />
</rich:column>
<rich:column>
<h:outputText value="#{registeredUsrs.addressLine1}" />
, <h:outputText value="#{registeredUsrs.addressLine2}" />
, <h:outputText value="#{registeredUsrs.city}" />
, <h:outputText value="#{registeredUsrs.state}" />
, <h:outputText value="#{registeredUsrs.pinCode}" />
</rich:column>
<rich:column>
<h:outputText value="#{registeredUsrs.country}" />
</rich:column>
<rich:column>
<h:outputText value="#{registeredUsrs.dateOfBirth}" />
</rich:column>
<rich:column>
<h:outputText value="#{registeredUsrs.gender}" />
</rich:column>
</rich:dataTable>
<br />
<div align="center">
<rich:dataScroller for="registeredUsersDataTable" />
</div>
<br />
<h:outputLink
value="#{registeredUsersUIController.excelFile}">Export To Excel</h:outputLink>
<h:commandLink
action="#{registeredUsersUIController.goToHome()}"
value="Go to Home Page" style="margin-left:760px !important;" />
</div>

</html>

</h:form>

index.xhtml
When the application starts, by default index.xhtml will get called. Once the user clicks on the commandLink present in
this file, registeredUsersReport.xhtml will show the detailed report.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:form>
<div style="float: left; margin-left: 235px; margin-bottom: 5px;">
<h2>List Of Registered Users</h2>

</html>

<a4j:commandLink
action="#{registeredUsersUIController.getRegisteredUsers()}"
value="List of Registered Users of Website" />
</div>
</h:form>

Maven Update, Clean and Install


1)
2)
3)
4)
5)
6)

Right click on Project from project explorer


Select Maven-> Update Project
Right click on project from project explorer
select Run As -> Maven Clean
Right click on project from project explorer
select Run As -> Maven Install

This will now generate war file. You need to copy this war file and deploy it on tomcat.

You might also like