front end
En nuestro sts nos vamos a File->New->Maven ProjectSeleccionamos Create simple project (skip archetype selection) y presionamos next
LLenamos los siguientes campos y presionamos Finish:
- Group Id: com.tutosoftware.activity
- Artifact Id: activity
- Packaging: war
- Name: Mananger Activity
Ahora STS4 no trae para generar jsf nos vamos Help->Eclipse Marketplace...
Nos vamos a la pestaña que dice popular y selecionamos Eclipse Enterprise Java and Web Developer Tools 3.33 y presionamos install
En mi caso selecciones todas las opciones pero si no deseas las demas solo seleccionas las de JSF y presionas confirm
Aceptamos los terminos y presionamos Finish
le damos Select All y presionamos Trust Selected
le damos en reiniciar(restart)
Hacemos clic derecho sobre el proyecto y nos vamos a properties
Selecionamos:
- Dynamic Web Module:3.1
- Java Server Faces: 2.3
Nos Abre una ventana y en Type seleccionamos Disable Library Configuration... y presionamos OK
Presionamos Apply
Por ultimo Apply and close
Nos vamos al directorio src/main/webapp nos vamos a la carpeta WEB-INF y modificamos el web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="3.1">
<display-name>activity</display-name>
<absolute-ordering/>
<!-- load spring configuration -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>luna-amber</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>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/login.xhtml</welcome-file>
</welcome-file-list>
</web-app>
Nos vamos al archivo pom.xml y escribimos lo siguiente
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tutosoftware.activity</groupId>
<artifactId>activity</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Manager Activity</name>
<repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org/</url>
<layout>default</layout>
</repository>
</repositories>
<properties>
<primefaces.version>13.0.1</primefaces.version>
<jsf2.version>2.2.10</jsf2.version>
<jstl.version>1.2</jstl.version>
<jsp-api.version>2.1</jsp-api.version>
<servlet-api.version>3.1.0</servlet-api.version>
<itext.version>2.1.7</itext.version>
<poi.version>3.17</poi.version>
<elri.version>1.0</elri.version>
<javaeewebapi.version>7.0</javaeewebapi.version>
</properties>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${jsf2.version}</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${jsf2.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet-api.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>com.sun.el</groupId>
<artifactId>el-ri</artifactId>
<version>${elri.version}</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>${javaeewebapi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>${itext.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.35</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.35</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.28</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>
</project>