0

I searched thru stackoverflow for this error and all the answers relating to this do not seem to apply to my circumstance (or perhaps I overlooked something in those answers). Anyway, I am a self-taught newbie Java hobbyist, so any help will be greatly appreciated.

The classpath in Tomcat is '/webapps/ROOT/WEB-INF/classes/VidCollPkg/feedData.class'. My jsp file is located in 'webapps/appletv'.

Here is an extract from the error log:

Dec 31, 2012 12:41:48 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/appletv] threw      exception [/select.jsp (line: 11, column: 0) The value for the useBean class attribute   vidCollPkg.feedData is invalid.] with root cause
org.apache.jasper.JasperException: /select.jsp (line: 11, column: 0) The value for the   useBean class attribute vidCollPkg.feedData is invalid.

Here is the code for the class file (which compiles successfully):

package vidCollPkg;

import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;


public class feedData {

    java.sql.Connection con;

    public feedData() throws ClassNotFoundException, InstantiationException,  IllegalAccessException, SQLException {

        Class.forName("com.mysql.jdbc.Driver").newInstance();


        con = DriverManager.getConnection("jdbc:mysql://localhost/VideoDB? user=usr&password=pwd");

    }

    public ArrayList<String> getUnis() throws SQLException {
        ArrayList<String> vidList = new ArrayList<String>();
        String tryquery = "SELECT title FROM videoDB.vidtb ORDER BY title";
        java.sql.Statement stmt2 = con.createStatement();
        ResultSet rs1 = stmt2.executeQuery(tryquery);

        while (rs1.next()) {

            vidList.add(rs1.getString("title"));

        }

        return vidList;
    }


 }

Here is the code for my jsp file:

<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*"  errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Rate video</title>
</head>

<body>
<jsp:useBean id="obj" scope="page" class="vidCollPkg.feedData" />
<h1 align="center">RATE VIDEO</h1> <br>

<form name="frm" action="updateRecord.jsp">
Title: <select name="title">
       <c:forEach var="title" items="${obj.vids}">
       <option value="${title}">${title}</option>
       </c:forEach>
       </select><br>
Date Viewed: <input type="text" name="sDateVwd"><br>
Rating: <input type="text" name="rating"><br>
Comments: <br /><textarea name="comments" cols="40" rows="6"></textarea><br>
<input type="submit" value="Rate Video"><br />
<input type="reset" value="Reset" />
</form>
</body>
</html>

I have a feeling it's something simple I am overlooking. Thanks in advance for the help.

bachma0507
  • 1,543
  • 2
  • 11
  • 22

1 Answers1

0

Add vidCollPkg to the import section of the page tag in your jsp, and change the jsp:useBean class to just 'feedData'.

Skip Head
  • 7,580
  • 1
  • 30
  • 34
  • When I did that I get the error: 'java.lang.UnsupportedClassVersionError: feedData : Unsupported major.minor version 51.0' – bachma0507 Jan 01 '13 at 00:06