日期:2014-05-20  浏览次数:20595 次

在weblogic下调试关于JSP调用javabean的问题
部分代码如下(StudentManager是测试程序项目名称,程序在StudentManager\WEB-INF\classes\com\ydh目录下): 
package   com.ydh;      
  错误① "the   character     '- '   in   the   name   of   this   file   cannot   appear   in   the   java   identifier. "

import   java.io.*;
import   java.sql.*;
public   class   sqlconn        
错误② "the   package   of   this   type   does   not   match   its   location   on   the   source  
path:WEB.classes.com.ydh. "

{
.......  
}

testSQL.jsp引用代码(testSQL.jsp程序在StudentManager\目录下)如下:
<jsp:useBean   id= "dbBean "   scope= "page "   class= "com.ydh.sqlconn "/>    
错误③Type   com.ydh.sqlconn   contains   no   methods   with   this   name.

------解决方案--------------------
上面代码和出错信息都写在一起了。以上问题有那位大虾知道,多请指点。

------解决方案--------------------
第一个错误是由于JAVA中没有"-"标识符,可以用"_"
第二个是说包的位置不匹配,没有在src目录下
第三个是说名字为com.ydh.sqlconn的类中没有方法,既然是jsp:useBean,那么在bean类中是否存在对应的set/get方法
------解决方案--------------------
看看。。。。。。。。
------解决方案--------------------
3楼都说了