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

Struts2 en netbeans

Estas en el tema de Struts2 en netbeans en el foro de Java en Foros del Web. Hola, soy nuevo programando en Struts2. Actualmente estoy utilizando el IDE Netbeans en Ubuntu. Bueno, mi problema es el siguiente. Tengo un JSP, el cual ...
  #1 (permalink)  
Antiguo 22/10/2015, 18:40
 
Fecha de Ingreso: mayo-2013
Ubicación: Morelos
Mensajes: 3
Antigüedad: 10 años, 10 meses
Puntos: 0
Exclamación Struts2 en netbeans

Hola, soy nuevo programando en Struts2.
Actualmente estoy utilizando el IDE Netbeans en Ubuntu.

Bueno, mi problema es el siguiente.
Tengo un JSP, el cual al querer ejecutarlo me manda el siguiente error:

HTTP Status 500 - Internal Server Error

type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

root cause

The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs.


Este es el codigo de mi JSP:
<?xml version="1.0" encoding="UTF-8"?>
<%@taglib uri="/struts-tags" prefix="s" %>
<%@page pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Datos de Usuario</title>
</head>
<body>
<h1>Datos de Usuario</h1>
<s:form action="datosUsuario">
<s:textfield name="nombre" label="Nombre" />
<s:textfield name="username" label="Username" />
<s:password name="password" label="Password" />
<s:textfield name="edad" label="Edad" />
<s:textfield name="fechaNacimiento" label="Fecha de Nacimiento" />
<s:submit value="Enviar" />
</s:form>
</body>
</html>


He encontrado que al comentar la linea <%@taglib uri="/struts-tags" prefix="s" %>, se "arregla" el problema, pues corre el jsp pero no muestra nada.

Alguien me puede echar una mano por favor,:ojo tes:
  #2 (permalink)  
Antiguo 23/10/2015, 00:17
 
Fecha de Ingreso: abril-2009
Mensajes: 121
Antigüedad: 15 años
Puntos: 4
Respuesta: Struts2 en netbeans

Hola:

¿Puedes ver si está bien configurado el Dispatcher en el web.xml? El error indica:

The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter.

Te adjunto un ejemplo de configuración:

Código:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="http://java.sun.com/xml/ns/javaee" 
   xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
   http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
   id="WebApp_ID" version="3.0">
   
   <display-name>Struts 2</display-name>
   <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
   </welcome-file-list>
   
   <filter>
      <filter-name>struts2</filter-name>
      <filter-class>
         org.apache.struts2.dispatcher.FilterDispatcher
      </filter-class>
   </filter>

   <filter-mapping>
      <filter-name>struts2</filter-name>
      <url-pattern>/*</url-pattern>
   </filter-mapping>

</web-app>

Etiquetas: jsp, netbeans, struts2
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 22:12.