Foros del Web » Programación para mayores de 30 ;) » Java »

No Me Ejecuta El Servlet

Estas en el tema de No Me Ejecuta El Servlet en el foro de Java en Foros del Web. Hola A Todos.... Tengo Dos Servlets El Primero Tiene Este Codigo: @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código Java: Ver original if ( opcion. equals ( "R1" ) ) ...
  #1 (permalink)  
Antiguo 23/10/2010, 05:47
Avatar de LordJhony  
Fecha de Ingreso: septiembre-2010
Mensajes: 472
Antigüedad: 13 años, 7 meses
Puntos: 24
No Me Ejecuta El Servlet

Hola A Todos....
Tengo Dos Servlets El Primero Tiene Este Codigo:
Código Java:
Ver original
  1. if (opcion.equals("R1"))
  2.                 {
  3.                    String q="select Denominacion from simulador_ecaes.facultad where Id_Facultad='"+identificacion+"'";
  4.                    try
  5.                     {
  6.                         bd.valida=bd.ingreso.executeQuery(q);
  7.                         if(bd.valida.next())
  8.                         {
  9.                            consulta=bd.valida.getString(1);
  10.                            pag.println("<form method='post' action='Modificado'>");
  11.                            pag.println("<p><span class='style3'>Identificación:</span>");
  12.                            pag.println("&nbsp;&nbsp;&nbsp;<input type='text' name='id' value='"+id+"'</p>");
  13.                            pag.println("<p><span class='style3'>Denominacion:</span>");
  14.                            pag.println("&nbsp;&nbsp;<input type='text' name='tipo' id='tipo' value='"+consulta+"'></p>");
  15.                            pag.println("<p><span class='style3'>Cambiar Por:</span>");                             pag.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name='nuevo'>");
  16.                            pag.println("<option></option><option value='Facultad'>Facultad</option><option value='Escuela'>Escuela</option></select></p>");
  17.                            pag.println("<p><input type='submit' name='B1' id='B1' value='Modificar'>");
  18.                            pag.println("<input type='button' name='B2' id='B2' value='Cancelar' onclick='history.go(-1)'></p></form>");
  19. }}
Como Se Puede Ver El Servlet Me Dirige A Traves De Un Form A Otro Servlet
Llamado Modificado.
Codigo De Modificado:
Código Java:
Ver original
  1. public class Modificado extends HttpServlet
  2. {
  3.     protected void doPost(HttpServletRequest req, HttpServletResponse res)
  4.     throws ServletException, IOException
  5.     {
  6.         PrintWriter pag=null;
  7.         try
  8.         {
  9.             pag=res.getWriter();
  10.         }
  11.         catch(IOException e)
  12.         {
  13.             System.out.println("Error Con La Pagina "+e);
  14.         }
  15. try
  16.         {
  17.             if (req.getParameter("B1")!=null)
  18.             {
  19.                 Conexion bd= new Conexion();
  20.                 bd.init(this);
  21.                 String id=(req.getParameter("id")).trim();
  22.                 String tipo=(req.getParameter("nuevo")).trim();                
  23.                 String decano=(req.getParameter("nuevo")).trim();
  24.                 String inst=(req.getParameter("nuevo")).trim();
  25.                 pag.println(id+tipo);
Al Momento De Darle Clic Al Boton B1 Del Servlet Inicial El Cual Me Debe Dirigir Al Servlet Modificado Me Sale Este Error:
Cita:
HTTP Status 404 -

--------------------------------------------------------------------------------

type Status report

message

descriptionThe requested resource () is not available.


--------------------------------------------------------------------------------

GlassFish/v3
La Verdad No Se A Que Se Deba Ese Error Si Creo Ambos Servlets Estan Bien Formulados. Aclaro El Codigo De Los Servlets Posteado Solo Indica La Parte En La Que Me Genera El Error.
Si Alguien Me Puede Colaborar De Antemano Muchas Gracias
  #2 (permalink)  
Antiguo 25/10/2010, 02:21
Avatar de Fuzzylog  
Fecha de Ingreso: agosto-2008
Ubicación: En internet
Mensajes: 2.511
Antigüedad: 15 años, 7 meses
Puntos: 188
Respuesta: No Me Ejecuta El Servlet

No es por nada... pero

¿Estás seguro que incluiste el servlet en el web.xml y estás llamando al recurso de la misma forma que lo has puesto al añadirlo?
  #3 (permalink)  
Antiguo 25/10/2010, 05:01
Avatar de LordJhony  
Fecha de Ingreso: septiembre-2010
Mensajes: 472
Antigüedad: 13 años, 7 meses
Puntos: 24
Respuesta: No Me Ejecuta El Servlet

Te Pregunto... Este No Se Incluye Automaticamente Al Ejecutarlo. Si No Es Asi Entonces Como Lo Incluyo?
  #4 (permalink)  
Antiguo 25/10/2010, 05:46
Avatar de Fuzzylog  
Fecha de Ingreso: agosto-2008
Ubicación: En internet
Mensajes: 2.511
Antigüedad: 15 años, 7 meses
Puntos: 188
Respuesta: No Me Ejecuta El Servlet

Creo que es importante y debe ser así cuando intentes hacer algo y se te presenten dudas, porque lo normal es que a alguien le haya pasado antes.

Como resolver tus dudas en gogle:

Pues se hace una búsqueda de este tipo

http://www.google.es/search?hl=es&so...=&oq=&gs_rfai=

Luego se van mirando enlaces ... por ejemplo el tercero lo explica la mar de bien (Lee el punto 3 y 4)

http://www.adrformacion.com/cursos/j...tutorial4.html

Si google no te puede responder... entonces vete pensando en los foros :D y siento quitarle tráfico a forosdelweb, pero así mejora la calidad de los posts.

Etiquetas: servlet
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:15.