Olá, pessoal!
Estou revisando a estudar na java há um mês parado por causa começo na faculdade e tinha perdido na minha cabeça.. Favor me ajudar qual resolução essa problemas.
Mensagem de Erro:HTTP Status 404 - /TesteServletComJSP/Cadastro.jsp
--------------------------------------------------------------------------------
type Status report
message /TesteServletComJSP/Cadastro.jsp
description The requested resource (/TesteServletComJSP/Cadastro.jsp) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.30
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="IncluirServlet" method="get">
<table>
<tr><td>Nome:</td><td><input type="text" name="nome"></td></tr>
<tr><td>Idade:</td><td><input type="text" name="idade"></td></tr>
</table>
</form>
</body>
</html>
*/
public class IncluirServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String nome = request.getParameter("nome");
int idade = Integer.parseInt(request.getParameter("idade"));
Cadastro c = new Cadastro();
ArrayList<Cadastro> list = new ArrayList<Cadastro>();
c.setNome(nome);
c.setIdade(idade);
request.setAttribute("lista",c);
RequestDispatcher rd = request.getRequestDispatcher("TelaLista");
rd.forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<% Cadastro cad = (Cadastro) request.getAttribute("lista"); %>
<body>
Nome: <%cad.getNome(); %> <br>
Idade: <%cad.getIdade(); %>
</body>
</html>
Espero que vocês me ajudem..
Obrigado!