主题:各位高手看看咋解决这个问题?
错误如下:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 4 in the jsp file: /order.jsp
Generated servlet error:
C:\Documents and Settings\lee\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\work\Catalina\localhost\shop\org\apache\jsp\order_jsp.java:68: setUserID(java.lang.String) in cuug.OrderBean cannot be applied to (java.lang.Object)
orderBean.setUserID( session.getValue("memberID") );
^
An error occurred at line: 4 in the jsp file: /order.jsp
Generated servlet error:
Note: C:\Documents and Settings\lee\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\work\Catalina\localhost\shop\org\apache\jsp\order_jsp.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
1 error
*****************************************
order.jsp :
<%@ page language="java" contentType="text/html; charset=gb2312"%>
<jsp:useBean class="cuug.BookBean" id="bookinfo" scope="page"></jsp:useBean>
<jsp:useBean class="cuug.OrderBean" id="orderBean" scope="page"></jsp:useBean>
<%
/*禁止使用浏览器Cache,网页立即失效*/
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires",0);
orderBean.setUserID( session.getValue("memberID") );
%>
<HTML>
<HEAD>
<META http-equiv="Content-Style-Type" content="text/css">
<TITLE>
填写订单
</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
</BODY>
</HTML>
******************************************
OrderBean.java:
package cuug;
import java.sql.*;
public class OrderBean {
private static String strDBDriver="sun.jdbc.odbc.JdbcOdbcDriver";
private static String strDBUrl = "jdbc:odbc:booksore";
private Connection conn=null;
private ResultSet rs = null;
private java.lang.String bookinfo =null;
private java.lang.String Orderprice = null;
private java.lang.String orderDate = null;
private java.lang.String orderID = null;
private java.lang.String orderRem = null;
private java.lang.String receiverAddress = null;
private java.lang.String receiverName = null;
private java.lang.String receiverZip = null;
private java.lang.String UserID = null;
public OrderBean(){
try{
Class.forName(strDBDriver);
}
catch(java.lang.ClassNotFoundException e){
System.err.println("OrderBean.getLogontimes():"+e.getMessage());
}
}
public java.lang.String getOrderprice() {
return Orderprice;
}
/**
*返回定单的日期 。
* @return Java.lang.String
*/
public java.lang.String getOrderDate() {
orderDate = new java.util.Date().toString();
return orderDate;
}
/**
* 返回定单的ID号。
* @return Java.lang.String
*/
public java.lang.String getOrderID() {
return orderID;
}
public java.lang.String getReceiverName() {
return receiverName;
}
/**
* 返回接收者的邮政编码。
* @return Java.lang.String
*/
public java.lang.String getReceiverZip() {
return receiverZip;
}
/**
* 获得用户ID。
* @return Java.lang.String
*/
public java.lang.String getUserID() {
return UserID;
}
public void setBookinfo(java.lang.String newBookinfo) {
bookinfo = newBookinfo;
createNewOrder();
int fromIndex = 0;
int tmpIndex = 0;
int tmpEnd = 0;
String strSql = null;
try{
conn = DriverManager.getConnection(strDBUrl);
Statement stmt = conn.createStatement();
System.out.println(fromIndex+"====");
while(bookinfo.indexOf(';',fromIndex) != -1 ){
tmpEnd = bookinfo.indexOf(';',fromIndex);
tmpIndex = bookinfo.lastIndexOf('=',tmpEnd);
strSql = "insert into orderdetail(orderID,bookISBN,bookcount) values("+ getOrderID()+ ", '" + bookinfo.substring(fromIndex ,tmpIndex) + "','" + bookinfo.substring(tmpIndex+1 ,tmpEnd) + "')" ;
stmt.executeUpdate(strSql);
fromIndex = tmpEnd + 1;
}
stmt.close();
conn.close();
System.out.println(strSql+"asdf");
}
catch(SQLException e){
System.err.println( e.getMessage());
}
}
public void setUserID(java.lang.String newUserID) {
UserID = newUserID;
}
public static void main(String args[])
{
System.out.println("asdf");
//OrderBean buyer = new OrderBean();
//buyer.createNewOrder();
}
}
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 4 in the jsp file: /order.jsp
Generated servlet error:
C:\Documents and Settings\lee\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\work\Catalina\localhost\shop\org\apache\jsp\order_jsp.java:68: setUserID(java.lang.String) in cuug.OrderBean cannot be applied to (java.lang.Object)
orderBean.setUserID( session.getValue("memberID") );
^
An error occurred at line: 4 in the jsp file: /order.jsp
Generated servlet error:
Note: C:\Documents and Settings\lee\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\work\Catalina\localhost\shop\org\apache\jsp\order_jsp.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
1 error
*****************************************
order.jsp :
<%@ page language="java" contentType="text/html; charset=gb2312"%>
<jsp:useBean class="cuug.BookBean" id="bookinfo" scope="page"></jsp:useBean>
<jsp:useBean class="cuug.OrderBean" id="orderBean" scope="page"></jsp:useBean>
<%
/*禁止使用浏览器Cache,网页立即失效*/
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires",0);
orderBean.setUserID( session.getValue("memberID") );
%>
<HTML>
<HEAD>
<META http-equiv="Content-Style-Type" content="text/css">
<TITLE>
填写订单
</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
</BODY>
</HTML>
******************************************
OrderBean.java:
package cuug;
import java.sql.*;
public class OrderBean {
private static String strDBDriver="sun.jdbc.odbc.JdbcOdbcDriver";
private static String strDBUrl = "jdbc:odbc:booksore";
private Connection conn=null;
private ResultSet rs = null;
private java.lang.String bookinfo =null;
private java.lang.String Orderprice = null;
private java.lang.String orderDate = null;
private java.lang.String orderID = null;
private java.lang.String orderRem = null;
private java.lang.String receiverAddress = null;
private java.lang.String receiverName = null;
private java.lang.String receiverZip = null;
private java.lang.String UserID = null;
public OrderBean(){
try{
Class.forName(strDBDriver);
}
catch(java.lang.ClassNotFoundException e){
System.err.println("OrderBean.getLogontimes():"+e.getMessage());
}
}
public java.lang.String getOrderprice() {
return Orderprice;
}
/**
*返回定单的日期 。
* @return Java.lang.String
*/
public java.lang.String getOrderDate() {
orderDate = new java.util.Date().toString();
return orderDate;
}
/**
* 返回定单的ID号。
* @return Java.lang.String
*/
public java.lang.String getOrderID() {
return orderID;
}
public java.lang.String getReceiverName() {
return receiverName;
}
/**
* 返回接收者的邮政编码。
* @return Java.lang.String
*/
public java.lang.String getReceiverZip() {
return receiverZip;
}
/**
* 获得用户ID。
* @return Java.lang.String
*/
public java.lang.String getUserID() {
return UserID;
}
public void setBookinfo(java.lang.String newBookinfo) {
bookinfo = newBookinfo;
createNewOrder();
int fromIndex = 0;
int tmpIndex = 0;
int tmpEnd = 0;
String strSql = null;
try{
conn = DriverManager.getConnection(strDBUrl);
Statement stmt = conn.createStatement();
System.out.println(fromIndex+"====");
while(bookinfo.indexOf(';',fromIndex) != -1 ){
tmpEnd = bookinfo.indexOf(';',fromIndex);
tmpIndex = bookinfo.lastIndexOf('=',tmpEnd);
strSql = "insert into orderdetail(orderID,bookISBN,bookcount) values("+ getOrderID()+ ", '" + bookinfo.substring(fromIndex ,tmpIndex) + "','" + bookinfo.substring(tmpIndex+1 ,tmpEnd) + "')" ;
stmt.executeUpdate(strSql);
fromIndex = tmpEnd + 1;
}
stmt.close();
conn.close();
System.out.println(strSql+"asdf");
}
catch(SQLException e){
System.err.println( e.getMessage());
}
}
public void setUserID(java.lang.String newUserID) {
UserID = newUserID;
}
public static void main(String args[])
{
System.out.println("asdf");
//OrderBean buyer = new OrderBean();
//buyer.createNewOrder();
}
}