I have a Spring Boot Application. I am trying to pass a variable to a HTML page but unfortunately I cannot seem to do it, on application start nothing is rendered except the static text: "WORLD". My controller is as below:
#Controller
public class IndexController {
#RequestMapping(value = "/index", method = RequestMethod.GET)
public String index(Model model) {
model.addAttribute("message", "HELLO");
return "index";
}
}
And my index.html:
<html>
<body>
<h1>${message}</h1>
<h2>WORLD</h2>
</body>
</html>
I was looking for an answer and I found these articles:
How to serve .html files with Spring
How to serve html files with Spring
How to handle static content in Spring MVC?
These are useful examples, but in my project I don't have files such as: mvc-dispatcher-servlet.xml, web.xml, or even the whole WEB-INF directory.
The files I have after creating a Spring MVC Project are in the screenshot below. Should I add the files mentioned in the above literature to fix this issue or what?
My Project view via IntelliJ IDEA:
My pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<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>offersmanager</groupId>
<artifactId>webapp</artifactId>
<version>1</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.6.RELEASE</version>
</parent>
<properties>
<!-- Java version -->
<java.version>1.8</java.version>
<!-- Use UTF-8 sources encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Local model -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>model</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Spring boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<!-- MAIN CODE SETTINGS -->
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<!-- TEST CODE SETTINGS -->
<testSourceDirectory>src/test/java</testSourceDirectory>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
You're using Thymeleaf as your templating language, and you should read the documentation for it. In Thymeleaf, to substitute a variable, you'll use an attribute on the HTML tag, so something like this:
<html>
<body>
<h1 data-th-text="${message}">this gets replaced</h1>
<h2>WORLD</h2>
</body>
</html>
Related
I'm trying to use SpringBoot to display a .JSP page using embedded tomcat. Whenever I try to access the localhost URL, I get the Whitelabel Error Page with 404 Not Found. As you'll see below, I tried making a method for #RequestMapping to find the JSP location, to no avail. Previously, I was having issue importing Tomcat into pom.xml (was giving "not found" error). I fixed this by commenting out the <repositories> section in pom.xml, running it, then uncommenting it. How can I get my project to view .JSP files properly? I am following all steps in this Udemy course to a T. I will provide more info where needed.
SpringBoot version is 3.0.0 M3
My Java version is 18.0.1.1 2022-04-22
I'm using IntelliJ IDEA 2022.1.3 Community Edition
The JSP is called "sayHello.jsp" and it's located at /src/main/resources/META-INF/resources/WEB-INF/jsp/sayHello.jsp (the file directory picture below shows this). It just has Hello World HTML code in it
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0-M3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.springboot</groupId>
<artifactId>springboot-first-web-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springboot-first-web-app</name>
<description>My first SpringBoot web application from the Udemy Course</description>
<properties>
<java.version>18</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> <!-- Commenting/Un-commenting out <repositories> made it so tomcat-embed jasper dependency worked -->
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
SayHelloController.java (directory of files pictured later below)
package com.springboot.springbootfirstwebapp.hello;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
#Controller
public class SayHelloController
{
#RequestMapping("say-hello")
#ResponseBody
public String sayHelloDefault()
{
return "Hello! What are you learning today?";
}
#RequestMapping("say-hello-jsp")
public String sayHelloJsp()
{
return "sayHello";
}
#RequestMapping("say-hello-html")
#ResponseBody
public String sayHelloOld()
{
StringBuffer sb = new StringBuffer();
sb.append("<html>");
sb.append("<head>");
sb.append("<title>My first SpringBoot HTML page!</title>");
sb.append("</head>");
sb.append("<body>");
sb.append("This is an HTML page with a body!");
sb.append("</body>");
sb.append("</html>");
return sb.toString();
}
}
application.properties
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
# For more information
logging.level.org.springframework=debug
The DEBUG log showing the 404 Not Found error
My file directory in IntelliJ
Your folder structure is wrong. Should be
main -> webapp -> WEB-INF -> jsp -> sayHello.jsp
I'm trying to link css files to an html file like they do in the next tutorial https://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html but when I run the application in tomcat the HTML works but the CSS is missing and I get the next error on the browser console "Failed to load resource: the server responded with a status of 404 ()", contrary to this if I open the html without tomcat the css file works fine, so I'm pointing to the file correctly.
If it helps I've created the project with maven-archetype-webapp
Here is my project structure
HTML where I want to link the css file
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Web de productos - Inicias sesion</title>
<link rel="stylesheet" type="text/css" media="all"
href="../../css/normalize.css" th:href="#{/css/normalize.css}" />
<link rel="stylesheet" type="text/css" media="all"
href="../../css/index.css" th:href="#{/css/index.css}" />
</head>
<body> ... </body>
</html>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>ss.webdeproductos</groupId>
<artifactId>WebDeProductos2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>WebDeProductos2 Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.6.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.21</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.11.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>WebDeProductos2</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Do you have any idea how to solve this problem?
There is a double definition of href in your thymeleaf templates, see href="../../css/normalize.css" th:href="#{/css/normalize.css}". You should remove one of those - check your html sources in browser the path will probably not match to your folder structure.
Thymeleaf has a different base location to check for static files like css (or js).
Since you are referencing css file this way th:href="#{/css/normalize.css}" try this folder structure:
WEB-INF/static
WEB-INF/static/css
WEB-INF/static/js
WEB-INF/templates
In my German blog I wrote an article about Spring Boot and Thymeleaf:
https://agile-coding.blogspot.com/2020/10/spring-mvc-thymeleaf.html
My sample code including the folder structure can be found here:
https://github.com/elmar-brauch/thymeleaf
I am attempting to work through an example to stand up a spring boot Hello World REST DSL camel application when I attempt to start the application up through spring boot, I receive the following exception:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.4.RELEASE:run (default-cli) on project helloworld-example: An exception occurred while running. null: InvocationTargetException: org.apache.camel.FailedToStartRouteException: Failed to start route route3 because of Multiple consumers for the same endpoint is not allowed: direct://hello -> [Help 1]
From what I can see and understand I have only configured a single route which links my "/hello" route to the bean which executes a method.
My route class:
package my.project.route;
import my.project.model.ResponseObject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestBindingMode;
import org.springframework.stereotype.Component;
#Component
public class MyRoute extends RouteBuilder {
#Override
public void configure() throws Exception {
// configures REST DSL to use servlet component and in JSON mode
restConfiguration()
.component("servlet")
.bindingMode(RestBindingMode.json);
// REST DSL with a single GET /hello service
rest()
.get("/hello")
.to("direct:hello");
// route called from REST service that builds a response message
from("direct:hello")
.log("Hello World")
.bean(this, "createResponse");
}
public ResponseObject createResponse() {
ResponseObject response = new ResponseObject();
response.setResponse("Hello World");
response.setName("stack overflow");
return response;
}
}
My Application code
package my.project;
import org.apache.camel.component.servlet.CamelHttpTransportServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
#SpringBootApplication
#Configuration
#ComponentScan("my.project")
public class Application {
/**
* A main method to start this application.
*/
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
#Bean
public ServletRegistrationBean camelServletRegistrationBean() {
ServletRegistrationBean registration = new ServletRegistrationBean(new CamelHttpTransportServlet(),"/camel/*");
registration.setName("CamelServlet");
return registration;
}
}
POM:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>my.project</groupId>
<artifactId>helloworld-example</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<name>Fabric8 :: Quickstarts :: Spring-Boot :: Camel</name>
<description>Spring Boot example running a Camel route</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Fuse 6.3 GA version for Spring Boot -->
<!--<spring-boot.version>1.4.1.RELEASE</spring-boot.version>-->
<!-- Fuse 7 EA / GA version for Spring Boot -->
<spring-boot.version>1.5.4.RELEASE</spring-boot.version>
<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>1.5.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servlet-starter</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson-starter</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-swagger-java-starter</artifactId>
<version>2.25.1</version>
</dependency>
</dependencies>
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<inherited>true</inherited>
<configuration>
<excludes>
<exclude>**/*KT.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- used for adding maven repositories to download Fuse JARs -->
<profiles>
<profile>
<id>fuse.repos</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>maven.central</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven.central</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</project>
Firstly, you don't need the camelServletRegistrationBean() bean in the Application class. That is only required for camel 2.19 and below. Instead add camel.component.servlet.mapping.context-path=/* in the application.properties file.
Also, you can get rid of the #ComponentScan. Since you have a #Component annotation on your route, spring will automatically add that to the context.
This question already has answers here:
Maven resource filtering not working - because of spring boot dependency [duplicate]
(1 answer)
Maven Resource Filtering with Spring Boot: Could not resolve placeholder
(1 answer)
Closed 6 years ago.
My application is packaged as WAR. I am trying to write the pom environment and timestamp to application.properties file. I tried using resource filtering but it didn't work. Looking forward for your help. Below are pom.xml and application.properties file.
application.properties
version.environment=${pom.env}
version.number=${pom.version}
version.buildnumber=${timestamp}
pom.xml(with resource fitering)
<?xml version="1.0" encoding="UTF-8"?>
<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>com.infoconnect.com</groupId>
<artifactId>ic-api</artifactId>
<version>2.0</version>
<packaging>war</packaging>
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent>
<properties>
<build.timestamp>${maven.build.timestamp}</build.timestamp>
<maven.build.timestamp.format>yyyy-MM-dd-HH-mm</maven.build.timestamp.format>
<servlet-api.version>3.0.1</servlet-api.version>
</properties>
<!-- Add typical dependencies for a web application -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<!-- Package as an executable JAR -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<!-- Allow access to Spring milestones and snapshots -->
<!-- (you don't need this if you are using anything after 0.5.0.M2) -->
</project>
I am trying to implement Richfaces with javax.faces-war-archetype version 2.2 in Netbeans 8.0.1 and GlassFish 4.1.
I have an existing project with richfaces implemented, if I build this it all works fine.
However when I create a new project (The exact same type and version) it gives the following error:
type Exception report
messageInternal Server Error
descriptionThe server encountered an internal error that prevented it from fulfilling this request.
exception java.lang.IllegalStateException
Even when I literally copy the pom.xml and web.xml from the working project to the new project it still gives this error.
The web.xml:
<?xml version='1.0' encoding='UTF-8'?>
<web-app version="3.0"
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_3_0.xsd">
<display-name>Test</display-name>
<context-param>
<description>
Tell the runtime where we are in the project development
lifecycle. Valid values are:
Development, UnitTest, SystemTest, or Production.
The runtime will display helpful hints to correct common mistakes
when the value is Development.
</description>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
The pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>nl.Test</groupId>
<artifactId>Test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>${project.artifactId}</name>
<description>A simple project with war packaging that depends on JSF 2.2 and
javaee 6, in that order.</description>
<url>http://jsf-spec.java.net/</url>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<version>3.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<spec.snapshot.version>2.2</spec.snapshot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.richfaces.bom.version>4.3.1.Final</org.richfaces.bom.version>
</properties>
<dependencies>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>${spec.snapshot.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${org.richfaces.bom.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
<version>4.3.1.Final</version>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
<version>4.3.1.Final</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>java.net-maven2-SNAPSHOT-repository</id>
<name>Java.net SNAPSHOT-Repository for Maven</name>
<url>https://maven.java.net/content/repositories/snapshots/</url>
<layout>default</layout>
</repository>
<repository>
<id>java.net-maven2-repository</id>
<name>Java.net Repository for Maven</name>
<url>https://maven.java.net/content/repositories/releases/</url>
<layout>default</layout>
</repository>
</repositories>
</project>
Does anyone know what I am doing wrong? (Or how I should set this up in the new project so that it works?)
Richfaces tutorials and answers to similar stackoverflow questions do not help resolving this problem. I have searched the following topics of stackoverflow:
How to add richfaces to maven project
java.lang.IllegalStateException: Illegal attempt to set ViewHandler after a response has been rendered
java.lang.IllegalStateException: Illegal attempt to set ViewHandler after a response has been rendered - Jsf1.2 in Weblogic 12c