-1
Hello, guys, sorry to bother you, but I’ve searched a lot about this problem in forums and videos, including in English, but I couldn’t solve it. I followed the steps of this tutorial: https://materialpublic.imd.ufrn.br/curso/disciplina/3/46/2/3 and nothing. It is a simple application in Servlet to create a "Hello, World", but the eclipse generates an error page with the following messages:
Type Status Report
Message The requested Resource [/aula02/Meuprimeiroservlet] is not available
Description The origin server Did not find a Current representation for the target Resource or is not willing to disclose that one exists.
As if the file did not exist.Since now thank you reply and thank you for your help.
follows below the code:
package servlet;
import java.io.IOException;
import javax.servlet.ServletConfig;
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 MeuPrimeiroServlet
*/
@WebServlet("/MeuPrimeiroServlet")
public class MeuPrimeiroServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public MeuPrimeiroServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see Servlet#init(ServletConfig)
*/
public void init(ServletConfig config) throws ServletException {
// TODO Auto-generated method stub
super.init(config);
}
/**
* @see Servlet#destroy()
*/
public void destroy() {
// TODO Auto-generated method stub
super.destroy();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String html = "<html><body><h1>Olá, Mundo!!!</h1></body></html>";
response.getWriter().append(html);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}