Im so grateful of the help this community has offered on my learning and production experience, i come to you with another question, thank you in advance.
Ok, i have a Flex + Spring + Hibernate + Tomcat + Mysql application that has been in development for 3 years. So now i need to add some html views on them. So what i intend to do is plug the jstl/jsp part of the spring framework to the project.
All the logic of the application is called from the view (flex) through one controller called CatalogFacadeImpl. So what i intend to do is create a bunch of controllers that call the method of CatalogFacadeImpl and throws the results to the new jstl views.
Problem is i´m having trouble connecting the mvc Controller Class, ModelAndView data to the jsp/jstl file.
Right now, in tests im making, i have the controller call the CatalogFacadeImpl like this:
public class Welcome implements Controller {
private String successView;
public static final String MAP_KEY = "categorias";
private CatalogFacadeImpl catalogFacadeImpl ;
public ModelAndView handleRequest(
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
List lista = catalogFacadeImpl.getUserList();
return new ModelAndView(getSuccessView(),MAP_KEY,lista);
}
public String getSuccessView() {
return successView;
}
public void setSuccessView(String successView) {
this.successView = successView;
}
public void setCatalogFacadeImpl(CatalogFacadeImpl catalog){
this.catalogFacadeImpl = catalog;
}
}
Which when i debug it , lista brings the right objects with the data! so it works!
The view without jstl works fine also, however when i add the code that should bring me the ModelAndView Success info i get the error :( here is the code (note, the html code doen't show right because of the editor, but it´s and html with the jstl code added):
taglib prefix="c" uri="http://java.sun.com/jstl/core"
<html>
<head><title>Example :: Spring Application</title></head>
<body>
<h1>Example - Spring Application</h1>
<p>Lista de usuarios</p>
<c:forEach items="${lista}" var="lista">
<tr>
<c:out value="${lista.userName}" />
<div></div>
</td>
</tr>
</c:forEach>
</body>
</html>
And error i get:
<html><head><title>Apache Tomcat/5.5.26 - Informe de Error</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>Estado HTTP 500 - </h1><hr noshade="noshade" size="1"><p><b>type</b> Informe de Excepción</p><p><b>mensaje</b> <u></u></p><p><b>descripción</b> <u>El servidor encontró un error interno () que hizo que no pudiera rellenar este requerimiento.</u></p><p><b>excepción</b> </p><pre>javax.servlet.ServletException: javax/el/ValueExpression
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:273)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:239)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1142)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:879)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.开发者_Python百科HttpServlet.service(HttpServlet.java:803)
</pre><p></p><p><b>causa raíz</b> </p><pre>java.lang.NoClassDefFoundError: javax/el/ValueExpression
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
java.lang.Class.getDeclaredMethods(Class.java:1791)
java.beans.Introspector$1.run(Introspector.java:1272)
java.security.AccessController.doPrivileged(Native Method)
java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
java.beans.Introspector.getBeanInfo(Introspector.java:387)
java.beans.Introspector.getBeanInfo(Introspector.java:159)
java.beans.Introspector.getBeanInfo(Introspector.java:220)
java.beans.Introspector.<init>(Introspector.java:368)
java.beans.Introspector.getBeanInfo(Introspector.java:159)
java.beans.Introspector.getBeanInfo(Introspector.java:220)
java.beans.Introspector.<init>(Introspector.java:368)
java.beans.Introspector.getBeanInfo(Introspector.java:159)
org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3729)
org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2132)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1600)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Generator.generate(Generator.java:3321)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:239)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1142)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:879)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
</pre><p></p><p><b>causa raíz</b> </p><pre>java.lang.ClassNotFoundException: javax.el.ValueExpression
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1363)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
java.lang.Class.getDeclaredMethods(Class.java:1791)
java.beans.Introspector$1.run(Introspector.java:1272)
java.security.AccessController.doPrivileged(Native Method)
java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
java.beans.Introspector.getBeanInfo(Introspector.java:387)
java.beans.Introspector.getBeanInfo(Introspector.java:159)
java.beans.Introspector.getBeanInfo(Introspector.java:220)
java.beans.Introspector.<init>(Introspector.java:368)
java.beans.Introspector.getBeanInfo(Introspector.java:159)
java.beans.Introspector.getBeanInfo(Introspector.java:220)
java.beans.Introspector.<init>(Introspector.java:368)
java.beans.Introspector.getBeanInfo(Introspector.java:159)
org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3729)
org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2132)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1600)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Generator.generate(Generator.java:3321)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:239)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1142)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:879)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
</pre><p></p><p><b>nota</b> <u>La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/5.5.26.</u></p><hr noshade="noshade" size="1"><h3>Apache Tomcat/5.5.26</h3></body></html>
Smells like a classloader problem.
javax.el.ValueExpression
only appeared in JSP 2.1, and Tomcat 5.5 only supports JSP 2.0 (see version matrix).
Something is clearly asking for javax.el.ValueExpression
, though, and I suspect you've packaged a copy of the JSTL, JSP and/or Servlet libraries in your WAR somewhere - those libraries may be for a newer version of JSP, and they'll clash with Tomcat's own libraries. Have a look to see if that's the case, and if so, remove the library from the WAR.
Also, your JSTL declaration is out of date. It should be
http://java.sun.com/jsp/jstl/core
not
http://java.sun.com/jstl/core
(this is the old, pre-JSP 2.0 URI).
Based on this forum, I think you might be bundling a conflicting servlet-api.jar with your code.
精彩评论