Friday, 15 July 2011

java - The value for the useBean class attribute myjsp.transactionBean is invalid -



java - The value for the useBean class attribute myjsp.transactionBean is invalid -

i have error value of java class invalid. have tried possible solution place web-inf/classes/myjsp/transactionbean project root folder. error still exists.

apache error

http status 500 - /ac.jsp(4,0) value usebean class attribute myjsp.transactionbean invalid.

type exception report

message /ac.jsp(4,0) value usebean class attribute myjsp.transactionbean invalid.

description server encountered internal error prevented fulfilling request.

exception

org.apache.jasper.jasperexception: /ac.jsp(4,0) value usebean class attribute myjsp.transactionbean invalid. org.apache.jasper.compiler.defaulterrorhandler.jsperror(defaulterrorhandler.java:40) org.apache.jasper.compiler.errordispatcher.dispatch(errordispatcher.java:407) org.apache.jasper.compiler.errordispatcher.jsperror(errordispatcher.java:148) org.apache.jasper.compiler.generator$generatevisitor.visit(generator.java:1233) org.apache.jasper.compiler.node$usebean.accept(node.java:1178) org.apache.jasper.compiler.node$nodes.visit(node.java:2361) org.apache.jasper.compiler.node$visitor.visitbody(node.java:2411) org.apache.jasper.compiler.node$visitor.visit(node.java:2417) org.apache.jasper.compiler.node$root.accept(node.java:495) org.apache.jasper.compiler.node$nodes.visit(node.java:2361) org.apache.jasper.compiler.generator.generate(generator.java:3461) org.apache.jasper.compiler.compiler.generatejava(compiler.java:231) org.apache.jasper.compiler.compiler.compile(compiler.java:354) org.apache.jasper.compiler.compiler.compile(compiler.java:334) org.apache.jasper.compiler.compiler.compile(compiler.java:321) org.apache.jasper.jspcompilationcontext.compile(jspcompilationcontext.java:592) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:328) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:313) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:260) javax.servlet.http.httpservlet.service(httpservlet.java:717) note total stack trace of root cause available in apache tomcat/6.0.36 logs.

here html code

<html> <head><title>search transaction </title> </head> <body><table border = 1> search transaction : <br> <form action = "ac.jsp"> <tr><td>transactionid</td><td><input type =text name="tid"></td></tr> <tr><td></td><td><input type = submit value ="search" ></td></tr> </form> </table> </body> </html>

here jsp code

<%@page import = "java.sql.*" %> <%@page import = "java.util.*" %> <%@page import = "myjsp.transactionbean"%> <jsp:usebean id="cb" scope="session" class="myjsp.transactionbean"/> <html> <body> <table border = 1> <tr><td>transactionid</td><td>bookid</td><td>quantity</td><td>transaction type</td></tr> <% int tid = integer.parseint(request.getparameter("tid")); class.forname("sun.jdbc.odbc.jdbcodbcdriver"); connection connection = drivermanager.getconnection("jdbc:odbc:tpbooks","",""); statement statement = connection.createstatement(); resultset columns = statement.executequery("select transactionid, bookid, transactionqty, transactiontype transactions transactionid="+tid+" order bookid"); %> <% cb.setsales(19.23); while (columns.next()){ int ti = columns.getint("transactionid"); int bid = columns.getint("bookid"); int tqty = columns.getint("transactionqty"); string ttype = columns.getstring("transactiontype"); %> <tr> <td><%=ti%></td> <td><%=bid%></td> <td><%=tqty%></td> <td><%=ttype%></td> </tr> <%} columns.close(); statement.close(); connection.close(); %> total turn a profit : <%=cb.totalprofit()%> </body> </table> </html>

are sure bean name transactionbean ? assuming should transactionbean .

other looks fine me.

also please verify import statement , set transactionbean under web-inf/classes/myjsp

edit: create sure there public default constructor without arguments

java class javabeans

No comments:

Post a Comment