Olá , galera estou fazendo um trabalho de faculdade onde só posso
usar Servlet sem taglib mas estou tendo um erro ao chamar uma opção do menu.jsp
me dá essa mensagem
HTTP Status 404 - /prova/pagina/controller
type Status report
message /prova/pagina/controller
description The requested resource (/prova/pagina/controller) is not available.
JBossWeb/2.0.0.GA
o fluxo das telas é o seguinte primeiro chama o index.jsp do contexto depois
chama o menu.jsp que está no diretório pagina e quando escolho uma opção
que vai chamar o servlet dá o erro …
alguém pode me ajudar …
abs
--index.jsp
<!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>Menu Principal</title>
<h1>Menu Principal</h1>
</head>
<body>
<table width="75%" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">Escolha uma Opção </td>
</tr>
<tr></tr>
<tr></tr>
<tr>
<td>
<a >Lista de Clientes</a>
</td>
</tr>
</table>
</body>
</html>
--menu.jsp
<h1>Menu Principal</h1>
</head>
<body>
<table width="75%" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">Escolha uma Opção </td>
</tr>
<tr></tr>
<tr></tr>
<tr>
<td>
<a >Lista de Clientes</a>
</td>
</tr>
<tr>
<td>
<a >Incluir de Cliente</a>
</td>
</tr>
</table>
</body>
</html>
---web.xml
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>br.com.paulo.prova.servlet.ServletAction</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>/controller</url-pattern>
</servlet-mapping>
</web-app>
----
---servlet
public class ServletAction extends HttpServlet {
RequestDispatcher rd=null;
public ServletAction() {
// TODO Auto-generated constructor stub
}
public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
PrintWriter out = resp.getWriter();
String acao=req.getParameter("acao");
Class clazz = Class.forName("br.com.paulo.prova.action." + acao + "Action");
System.out.println("acao="+acao);
System.out.println("idcliente="+req.getParameter("idcliente"));
Action action = (Action) clazz.newInstance();
String Mapping = action.execute(req,resp);
rd = req.getRequestDispatcher(Mapping);
rd.forward(req,resp);
out.println("<h1>Lista</h1>"+acao);
}catch(Exception e){
req.setAttribute("erro", e);
rd = req.getRequestDispatcher("/pagina/erro.jsp");
rd.forward(req,resp);
System.out.println("Erro="+e);
}
}