I'm following the E-book "Java EE7 with JSF, PrimeFaces and CDI". I created the Maven project, I edited the file pom.xml
as the handbook guides, when I created the OiMundoServlet.java
sample file, I noticed that errors appeared in the handbook, but when editing the file pom.xml
again to eliminate the errors, those same mistakes are not gone. How to fix this?
- Note 1: I am using the latest version of Eclipse Java EE (Mars.1 Release (4.5.1))
- Note 2: When I added the apache 8 server, when linking the Maven project, I noticed the following error:
Project facet Java version 1.8 is not supported
. - Note 3: The
web.xml
file was not created automatically. I had to create it because it reported an error in the filepom.xml
in the line referring to<packaging>war</packaging>
.
Follow the code:
package br.com.farmsystem.servlet;//essa linha apresenta erro
import java.io.IOException;//essa linha apresenta erro
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class OiMundoServlet
*/
@WebServlet("/oi-mundo")
public class OiMundoServlet extends HttpServlet { //essa linha apresenta erro
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public OiMundoServlet() {
super();//essa linha apresenta erro
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {//essa linha apresenta erro
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {//essa linha apresenta erro
// TODO Auto-generated method stub
}
}