Displaytag issue
I am trying to use displaytag for the first time and have an issue with displaytag that I cannot seem to solve. I googled for a solution but couldn't find anything over the internet. Everything else works, it's the only thing that doesn't work.
Basically I'm trying to just do a simple display of the table.
the error I am getting:
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: org.apache.jasper.JasperException: Unable to load class for JSP
JSP page:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="dt" %>
<%--<jsp:useBean id="ForumList" scope="session" class="mysql.Forum" />--%>
<% session.setAttribute( "test2", mysql.Forum.getMyTopics() ); %>
<dt:table name="sessionScope.test2" />
and my class which is really simple
package mysql;
import java.sql.*;
import java.sql.Connection;
import java.lang.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.jstl.sql.Result;
import javax.servlet.jsp.jstl.sql.ResultSupport;
public class Forum {
public Connection con = null;
public Result myTopics = null;
public MysqlBase mysql = new MysqlBase();
public Result getMyTopics()
{
try
{
con = mysql.getConnection();
Statement stmt = con.createStatement();
ResultSet result = stmt.executeQuery("Select * from lawers_topics");
myTopics = ResultSupport.toResult(result);
con.close();
stmt.close();
}
catch(Exception e)
{
}
//request.setAttribute("MyTopics", this.myTopics);
return this.myTopics;
}
}
I would really appreciate if someone can point me in the right direction.
EDIT: I forgot to say that I am using NetBeans and Tomcat6.0 for development.
a source to share
The "Unable to load class for JSP" error tells me that Tomcat cannot find one or more of the class files you referenced in the jsp. Are you sure your mysql.Forum class is on the classpath (in this case WEB-INF / classes / mysql / Forum.class)?
Also, it looks like you are trying to call getMyTopics () from your script as if it were a static method of the Forum class, but it was not static.
a source to share