Problema con clase Action de struts

thepolice0101
19 de Agosto del 2004
Hola como estan, espero que me puedan ayudar con este problema, estoy haciendo una aplicacion pequeña basada en struts, la version de struts con la q estoy trabajando es 20040415 q la obtuve de "http://jakarta.apache.org/struts". El problema es que despues que cargo el formulario de inicio y luego de hacer un submit, la clase action encargada de hacer la validacion de este formulario y emitir el resultado(una pagina de salida o mostrar los errores en el ingreso de datos) emite como resultado una pagina en blanco ya sea q el formulario este correctamente llenado o no, la url de esta pagina en blanco es "http://localhost:8081/validateEmployee.do;jsessionid=68F101E90A09130ACA45966636CF31C1", quizas el causante del error sea q cuando compilo mis clases me sale el siguiente error en la clase de accion (estoy trabajando en linux):


[[email protected] classes]# javac com/example/*.java
Note: com/example/ValidateEmployeeAction.java uses or overrides a deprecated API
.
Note: Recompile with -deprecation for details.

******
y cuando recompilo usando -deprecation sale algo asi:

[[email protected] classes]# javac -deprecation com/example/ValidateEmployeeAction.java
com/example/ValidateEmployeeAction.java:14: warning: org.apache.struts.action.ActionError in org.apache.struts.action has been deprecated
import org.apache.struts.action.ActionError;
^
com/example/ValidateEmployeeAction.java:35: warning: org.apache.struts.action.ActionError in org.apache.struts.action has been deprecated
ActionError error=new ActionError("error.missing.name");
^
com/example/ValidateEmployeeAction.java:35: warning: org.apache.struts.action.ActionError in org.apache.struts.action has been deprecated
ActionError error=new ActionError("error.missing.name");
^
com/example/ValidateEmployeeAction.java:36: warning: add(java.lang.String,org.apache.struts.action.ActionError) in org.apache.struts.action.ActionErrors has been deprecated
errors.add("ActionErrors.GLOBAL_ERROR",error);
^
com/example/ValidateEmployeeAction.java:41: warning: org.apache.struts.action.ActionError in org.apache.struts.action has been deprecated
ActionError error=new ActionError("error.missing.department");
^
com/example/ValidateEmployeeAction.java:41: warning: org.apache.struts.action.ActionError in org.apache.struts.action has been deprecated
ActionError error=new ActionError("error.missing.department");
^
com/example/ValidateEmployeeAction.java:42: warning: add(java.lang.String,org.apache.struts.action.ActionError) in org.apache.struts.action.ActionErrors has been deprecated
errors.add("ActionErrors.GLOBAL_ERROR",error);
^
com/example/ValidateEmployeeAction.java:47: warning: org.apache.struts.action.ActionError in org.apache.struts.action has been deprecated
ActionError error=new ActionError("error.missing.skills");
^
com/example/ValidateEmployeeAction.java:47: warning: org.apache.struts.action.ActionError in org.apache.struts.action has been deprecated
ActionError error=new ActionError("error.missing.skills");
^
com/example/ValidateEmployeeAction.java:48: warning: add(java.lang.String,org.apache.struts.action.ActionError) in org.apache.struts.action.ActionErrors has been deprecated
errors.add("ActionError.GLOBAL_ERROR",error);
^
com/example/ValidateEmployeeAction.java:52: warning: saveErrors(javax.servlet.http.HttpServletRequest,org.apache.struts.action.ActionErrors) in org.apache.struts.action.Action has been deprecated
saveErrors(request,errors);
^
11 warnings

*************
Alguien sabe porque sale este error al compilar y porque la clase de accion me lleva a una pagina en blanco .

Para ser mas explicito pondre aqui el codigo de las clases y paginas que utilizo, si alguien tiene tiempo y puede ayudarme le agradeceria de antemao:

VALIDATEEMPLOYEEACTION.JAVA
package com.example;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionServlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;

import java.io.IOException;
import java.util.List;
public class ValidateEmployeeAction extends Action{

/** Creates a new instance of ValidateEmployeeAction */
public ValidateEmployeeAction(){
}

public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException{
ActionErrors errors=new ActionErrors();
EmployeeForm empForm=(EmployeeForm)form;

String name=empForm.getName();
if(name.trim().equals("")){
ActionError error=new ActionError("error.missing.name");
errors.add("ActionErrors.GLOBAL_ERROR",error);
}

String department=empForm.getDepartment();
if(department.trim().equals("")){
ActionError error=new ActionError("error.missing.department");
errors.add("ActionErrors.GLOBAL_ERROR",error);
}

String[] skills=empForm.getSkills();
if(skills==null){
ActionError error=new ActionError("error.missing.skills");
errors.add("ActionError.GLOBAL_ERROR",error);
}

if(errors.size()>0){
saveErrors(request,errors);
return new ActionForward(mapping.getInput());
}else{
return mapping.findForward("success");
}
}
}

**************

Mi form bean asociado a dicha clase (EmployeeForm.java)

package com.example;
import org.apache.struts.action.ActionForm;

public class EmployeeForm extends ActionForm
{
private String name="";
private String department="";
private String[] skills;

public String getName()
{
return name;
}
public void setName(String name)
{
this.name=name;
}
public String getDepartment()
{
return department;
}
public void setDepartment(String department)
{
this.department=department;
}
public String[] getSkills()
{
return skills;
}
public void setSkills(String[] skills)
{
this.skills=skills;
}
}

***************************
Tambien utilizo dos etiquetas, las cuales solo las uso pata insertar algunos valores en la pagina:

SkillsTag.jsp :

package com.example;

import javax.servlet.jsp.tagext.TagSupport;
import java.util.List;
import java.util.ArrayList;
/**
* Generated tag class.
*/

public class SkillsTag extends TagSupport {

public int doStartTag() throws JspException, JspException {

List skills=new ArrayList();
skills.add("EJB");
skills.add("Java Mail");
skills.add("JDBC");
skills.add("JMS");
skills.add("JNDI");
skills.add("JSP");
skills.add("JTA");
skills.add("Servlets");

pageContext.setAttribute("skillsList",skills);
return SKIP_BODY;
}

}
----------------

DepartmentTag.java :

package com.example;

import javax.servlet.jsp.tagext.TagSupport;
import java.util.List;
import java.util.ArrayList;

public class DepartmentTag extends TagSupport {

public int doStartTag() throws JspException, JspException {
List department=new ArrayList();
department.add("");
department.add("Client Server");
department.add("E-Commerce");
department.add("Legacy Integration");

pageContext.setAttribute("departmentList",department);

return SKIP_BODY;
}
}

---------------
El TLD de la biblioteca de etiquetas (generado por el IDE "Net Beans 3.5.1"):

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">



<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>app</short-name>
<uri>/app</uri>
<display-name>app</display-name>
<description>A blank tag library template.
</description>
<tag>
<name>departmentList</name>
<tag-class>com.example.DepartmentTag</tag-class>
<body-content>empty</body-content>
<description></description>

<example></example>
</tag>
<tag>
<name>skillsList</name>
<tag-class>com.example.SkillsTag</tag-class>
<body-content>empty</body-content>
<description></description>

<example></example>
</tag>

</taglib>

********************
El archivo web.xml :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
<!--<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>-->
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
<welcome-file>
index.html
</welcome-file>
<welcome-file>
index.htm
</welcome-file>
</welcome-file-list>

<taglib>
<taglib-uri>/bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/app</taglib-uri>
<taglib-location>/WEB-INF/app.tld</taglib-location>
</taglib>

</web-app>
********************************

El archivo struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<!--
Document : struts-config.xml
Created on : 23 de julio de 2004, 15:18
Author : root
Description:
Purpose of the document follows.
-->
<struts-config>
<form-beans>
<form-bean name="empForm" type="com.example.EmployeeForm"/>
</form-beans>
<action-mappings>
<action path="/validateEmployee"
type="com.example.ValidateEmployeeAction"
name="empForm"
scope="request"
input="/InputContent.jsp">
<forward name="success" path="/OutputContent.jsp"/>
</action>
</action-mappings>
<message-resources parameter="ApplicationResources"/>
</struts-config>

**********************

El archivo de recursos (ApplicationResources.properties) :

error.missing.name=<li><font color="red">Please enter the first name</font></li>

error.missing.department=<li><font color="red">Please pick a department</font></li>

error.missing.skills=<li><font color="red">Please select the relevant skills</font></li>

prompt.employee.name=<b>First Name :</b>

prompt.employee.department=<b>Department :</b>

prompt.employee.skills=<b>Skills :</b>

**********

Y por ultimo las dos JSPs

InputContent.jsp :
<%@ taglib uri="/app" prefix="app" %>
<%@ taglib uri="/bean" prefix="bean" %>
<%@ taglib uri="/html" prefix="html" %>
<%@ taglib uri="/logic" prefix="logic" %>

<html>
<head><title>JSP Page</title></head>
<body>
<html:errors/>
<app:departmentList/>
<app:skillsList/>
<html:form action="validateEmployee.do">
<TABLE>
<TR>
<TD align="right">
<bean:message key="prompt.employee.name"/>
</TD>
<TD>
<html:text property="name"/>
</TD>
</TR>
<TR>
<TD align="right">
<bean:message key="prompt.employee.department"/>
</TD>
<TD>
<html:select property="department">
<html:options name="departmentList"/>
</html:select>
</TD>
</TR>
<TR>
<TD align="right" valign="top">
<bean:message key="prompt.employee.skills"/>
</TD>
<TD>
<logic:iterate id="currentSkill" name="skillsList">
<html:multibox property="skills">
<%= currentSkill %>
</html:multibox>
<%=currentSkill %>
<BR>
</logic:iterate>
</TD>
</TR>
<TR>
<TD colspan='2' align="center">
<html:submit value="Validate"/>
</TD>
</TR>
</TABLE>
</html:form>
</body>
</html>
--------------------------

OutputContent.jsp :

<%@page contentType="text/html"%>
<%@taglib uri="/bean" prefix="bean" %>
<%@taglib uri="/logic" prefix="logic" %>

<html>
<head><title>JSP Page</title></head>
<body>
<TABLE>
<TR>
<TD align="right">
<bean:message key="prompt.employee.name"/>
</TD>
<TD>
<bean:write name="empForm" property="name"/>
</TD>
</TR>
<TR>
<TD align="right">
<bean:message key="prompt.employee.department"/>
</TD>
<TD>
<bean:write name="empForm" property="department"/>
</TD>
</TR>
<TR>
<TD align="right" valign="top">
<bean:message key="prompt.employee.skills"/>
</TD>
<TD>
<logic:iterate id="currentSkill" name="empForm" property="skills">
<%= currentSkill %>
<BR>
</logic:iterate>
</TD>
</TR>
</TABLE>
</body>
</html>
*****************************


Una cosa mas la version de tomcat con la q he estado trabajando es 4.0.6 que viene incluida en Net Veans 3.5.1 tambien lo probe en tomcat 5.0.19 (independiente) y me sale el siguiente eror al cargar la pagina de inicio q es muy diferente al anterior, alguien sabe porque sale este error:

type Informe de Excepción

mensaje

descripción El servidor encontró un error interno () que hizo que no pudiera rellenar este requerimiento.

excepción

javax.servlet.ServletException: javax.servlet.jsp.tagext.TagInfo.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljavax/servlet/jsp/tagext/TagLibraryInfo;Ljavax/servlet/jsp/tagext/TagExtraInfo;[Ljavax/servlet/jsp/tagext/TagAttributeInfo;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljavax/servlet/jsp/tagext/TagVariableInfo;Z)V
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:256)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

causa raíz

java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagInfo.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljavax/servlet/jsp/tagext/TagLibraryInfo;Ljavax/servlet/jsp/tagext/TagExtraInfo;[Ljavax/servlet/jsp/tagext/TagAttributeInfo;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljavax/servlet/jsp/tagext/TagVariableInfo;Z)V
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:469)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:291)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:205)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:458)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:523)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1577)
org.apache.jasper.compiler.Parser.parse(Parser.java:171)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:258)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:139)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

**************