2013-05-04 2 views
1

DisplayTag를 사용하여 Struts 2에서 페이지가 매겨진 테이블을 만들려고하고 있는데 제대로 작동하지 않습니다.struts2 오류가있는 DisplayTag

클래스의 이름 Profesores.java : 나는 다음과 같은 파일을 생성 한

package org.apache.struts.registro.model; 

public class Profesores { 
    private String nombre; 
    private String nacionalidad; 
    private String formacion; 
    private String aniosExperiencia; 
    private String clasesDomicilio; 
    private String clasesOnline; 
    private String correoElectronico; 
    private String correoElectronicoSeguridad; 
    private String movil; 
    private String tituloAnuncio; 
    private String descripcionAnuncio; 
    private long precio; 

    public Profesores(){ 

    } 

    public Profesores(String nombre,String nacionalidad,String tituloAnuncio){ 
     this.nombre = nombre; 
     this.nacionalidad = nacionalidad; 
     this.tituloAnuncio = tituloAnuncio; 
    } 


    public String getNombre() { 
     return nombre; 
    } 

    public void setNombre(String nombre) { 
     this.nombre = nombre; 
    } 

    public String getNacionalidad() { 
     return nacionalidad; 
    } 

    public void setNacionalidad(String nacionalidad) { 
     this.nacionalidad = nacionalidad; 
    } 

    public String getFormacion() { 
     return formacion; 
    } 

    public void setFormacion(String formacion) { 
     this.formacion = formacion; 
    } 

    public String getClasesDomicilio() { 
     return clasesDomicilio; 
    } 

    public void setClasesDomicilio(String clasesDomicilio) { 
     this.clasesDomicilio = clasesDomicilio; 
    } 

    public String getClasesOnline() { 
     return clasesOnline; 
    } 

    public void setClasesOnline(String clasesOnline) { 
     this.clasesOnline = clasesOnline; 
    } 

    public String getCorreoElectronico() { 
     return correoElectronico; 
    } 

    public void setCorreoElectronico(String correoElectronico) { 
     this.correoElectronico = correoElectronico; 
    } 

    public String getMovil() { 
     return movil; 
    } 

    public void setMovil(String movil) { 
     this.movil = movil; 
    } 

    public String getTituloAnuncio() { 
     return tituloAnuncio; 
    } 

    public void setTituloAnuncio(String tituloAnuncio) { 
     this.tituloAnuncio = tituloAnuncio; 
    } 

    public String getDescripcionAnuncio() { 
     return descripcionAnuncio; 
    } 

    public void setDescripcionAnuncio(String descripcionAnuncio) { 
     this.descripcionAnuncio = descripcionAnuncio; 
    } 

    public long getPrecio() { 
     return precio; 
    } 

    public void setPrecio(long precio) { 
     this.precio = precio; 
    } 

    public String getCorreoElectronicoSeguridad() { 
     return correoElectronicoSeguridad; 
    } 

    public void setCorreoElectronicoSeguridad(String correoElectronicoSeguridad) { 
     this.correoElectronicoSeguridad = correoElectronicoSeguridad; 
    } 

    public String getAniosExperiencia() { 
     return aniosExperiencia; 
    } 

    public void setAniosExperiencia(String aniosExperiencia) { 
     this.aniosExperiencia = aniosExperiencia; 
    } 
} 

액션의 이름 : ProfesoresAction

package org.apache.struts.registro.action; 

import java.util.ArrayList; 
import java.util.List; 

import org.apache.struts.registro.model.Profesores; 

import com.opensymphony.xwork2.ActionSupport; 

public class ProfesoresAction extends ActionSupport{ 
private static final long serialVersionUID = 1L; 

private List <Profesores> listaAnunciosProfesores = new ArrayList<Profesores>(); 

public String execute() throws Exception { 

    listaAnunciosProfesores.add(new Profesores("Johny","1","B.Tech")); 
    listaAnunciosProfesores.add(new Profesores("Lourde","2","M.Tech")); 
    listaAnunciosProfesores.add(new Profesores("Mark Boucher","3","B.Tech")); 
    listaAnunciosProfesores.add(new Profesores("Sandy","4","B.Tech")); 
    listaAnunciosProfesores.add(new Profesores("Teena","5","MCA")); 
    listaAnunciosProfesores.add(new Profesores("Michal Bevan","6","M.Tech")); 
    listaAnunciosProfesores.add(new Profesores("Saranya","7","MCA")); 
    listaAnunciosProfesores.add(new Profesores("Rahamat","8","B.Tech")); 
    listaAnunciosProfesores.add(new Profesores("Rahul","9","M.Tech")); 
    listaAnunciosProfesores.add(new Profesores("Sugan","10","B.Tech")); 
    setListaAnunciosProfesores(listaAnunciosProfesores); 
    return SUCCESS; 
} 

public List<Profesores> getListaAnunciosProfesores() { 
    return listaAnunciosProfesores; 
} 

public void setListaAnunciosProfesores(List<Profesores> listaAnunciosProfesores) { 
    this.listaAnunciosProfesores = listaAnunciosProfesores; 
} 

} 

struts.xml :

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE struts PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" 
"http://struts.apache.org/dtds/struts-2.0.dtd"> 

<struts> 

<constant name="struts.enable.DynamicMethodInvocation" value="false" /> 
<constant name="struts.devMode" value="true" /> 

<package name="basicstruts2" extends="struts-default"> 

<!-- If no class attribute is specified the framework will assume success and 
render the result index.jsp --> 
<!-- If no name value for the result node is specified the success value is the default --> 
<action name="index"> 
<result>/index.jsp</result> 
</action> 

<!-- If the URL is hello.action the call the execute method of class HelloWorldAction. 
If the result returned by the execute method is success render the HelloWorld.jsp --> 
<action name="hello" class="org.apache.struts.helloworld.action.HelloWorldAction" method="execute"> 
<result name="success">/HelloWorld.jsp</result> 
</action> 

<action name="register" class="org.apache.struts.registro.action.Register" method="execute"> 
<result name="success">/thankyou.jsp</result> 
<result name="input">/register.jsp</result> 
</action> 

<action name="registroProfesores" class="org.apache.struts.registro.action.RegistroProfesores" method="execute"> 
<result name="success">/thankyou.jsp</result> 
<result name="input">/registroProfesores.jsp</result> 
</action> 

<action name="listaProfesores" class="org.apache.struts.registro.action.ProfesoresAction" method="execute"> 
<result name="success">/ListaProfesores.jsp</result> 
</action> 
</package> 
</struts> 

JSP의 이름 :

may 04, 2013 10:00:12 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar 
INFO: Al menos un JAR, que se ha explorado buscando TLDs, aún no contenía TLDs. Activar historial de depuración para este historiador para una completa lista de los JARs que fueron explorados y de los que nos se halló TLDs. Saltarse JARs no necesarios durante la exploración puede dar lugar a una mejora de tiempo significativa en el arranque y compilación de JSP . 
may 04, 2013 10:00:12 PM org.apache.catalina.core.StandardWrapperValve invoke 
SEVERE: El Servlet.service() para el servlet [jsp] en el contexto con ruta [/Form_Validation_Struts2_Ant] lanzó la excepción [java.lang.NoClassDefFoundError: org/apache/commons/lang/UnhandledException] con causa raíz 
java.lang.ClassNotFoundException: org.apache.commons.lang.UnhandledException 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711) 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556) 
at java.lang.Class.getDeclaredConstructors0(Native Method) 
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) 
at java.lang.Class.getConstructor0(Unknown Source) 
at java.lang.Class.newInstance0(Unknown Source) 
at java.lang.Class.newInstance(Unknown Source) 
at com.sun.beans.finder.InstanceFinder.instantiate(Unknown Source) 
at com.sun.beans.finder.InstanceFinder.find(Unknown Source) 
at java.beans.Introspector.findExplicitBeanInfo(Unknown Source) 
at java.beans.Introspector.<init>(Unknown Source) 
at java.beans.Introspector.getBeanInfo(Unknown Source) 
at org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3943) 
at org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2209) 
at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1640) 
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539) 
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376) 
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428) 
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434) 
at org.apache.jasper.compiler.Node$Root.accept(Node.java:475) 
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376) 
at org.apache.jasper.compiler.Generator.generate(Generator.java:3489) 
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:250) 
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373) 
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) 
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) 
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646) 
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) 
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) 
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) 
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) 
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999) 
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565) 
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
at java.lang.Thread.run(Unknown Source) 

가, 누군가가 나를 도울 수하십시오 ListaProfesores.jsp는

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> 
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> 
<%@ taglib prefix="s" uri="/struts-tags" %> 
<!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> 
<display:table name="listaAnunciosProfesores" requestURI="listaProfesores" pagesize="2" export="false"> 
<display:column property="nombre" title="Roll" paramId="nombre" sortable="true"/> 
<display:column property="nacionalidad" title="Name" sortable="true"/> 
<display:column property="tituloAnuncio" title="Course" sortable="true" /> 
</display:table> 
</body> 
</html> 

이 오류에 직면하고있어?

+0

지금까지 하나 이상의 종속성 중 적절한 버전이없는 것 같습니다. Maven을 사용하고 있습니까? 또한 관련된 모든 사람들의 온정을 위해 JSP와 XML 파일을 들여 씁니다. –

+0

EL은 표현식 언어를 나타내며, EL 표현식을 struts 태그에서 사용할 수 없습니다. –

+0

답장을 보내 주셔서 감사합니다. Maven을 사용하지 않고 Ant를 사용하고 있습니다. 나는이 웹 사이트에서 더 많은 의존성을 설치했다 : http://displaytag.sourceforge.net/11/displaytag/dependencies.html – user2350650

답변