当前位置: 技术问答>java相关
javabean调用ejb,jsp调用javabean.出现了如下问题,需要高手出现啊!
来源: 互联网 发布时间:2015-06-16
本文导语: 我的jsp文件:login.jsp 欢迎登录系统 0) response.sendRedirect("index.html"); else response.sendRedirect("helloworld.html"); %> 我的jav...
我的jsp文件:login.jsp
欢迎登录系统
0)
response.sendRedirect("index.html");
else
response.sendRedirect("helloworld.html");
%>
我的javabean如下:
userLogin.java
import java.sql.*;
import java.rmi.*;
import javax.ejb.CreateException;
import javax.naming.*;
import javax.rmi.*;
public class userLogin{
private String accountID,password;
private int rsCount;
private accessDB connBean=null;
public userLogin(){
try{
InitialContext initial = new InitialContext();
Object objref = initial.lookup("connectionDB.accessDB"); accessDBHome home =(accessDBHome)PortableRemoteObject.narrow(objref,accessDBHome.class);
connBean = home.create();
}catch(NamingException ne){
System.out.println("naming Exception caught:"+ne);
}catch(CreateException ce){
System.out.println("Create Exception caught:"+ce);
}catch(RemoteException re){
System.out.println("Remote Exception caught:"+re);
}
}
public void setAccountID(String accountID){
this.accountID=accountID;
}
public void setPassword(String password){
this.password=password;
}
public int getRsCount(){
//Get the number of resultset through the accessDB
setRsCount();
return this.rsCount;
}
private void setRsCount(){
String sqlSelect="select * from Users where Username='"+accountID+"' and Password='"+password+"'";
try{
rsCount=connBean.rsCount(sqlSelect);
}catch(RemoteException re){
System.out.println("Remote Exception caught:"+re);
}catch(SQLException se)
{
System.out.println("sqlexception caught :"+se);
}
}
}
我的ejb已经配置好了,userLogin.class文件是在weblogic6.1下Gradesweb-infclasses目录中,.jsp文件在Grades下,
现在的问题是,运行。jsp文件,出现如下问题:
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:90: cannot resolve symbol
probably occurred due to an error in /login.jsp line 9:
Full compiler error(s):
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:90: cannot resolve symbol
symbol : class userLogin
location: class jsp_servlet._login
userLogin user = null; //[ /login.jsp; Line: 9]
^
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:91: cannot resolve symbol
symbol : class userLogin
location: class jsp_servlet._login
user = (userLogin)pageContext.getAttribute("user"); //[ /login.jsp; Line: 9]
^
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:94: cannot resolve symbol
symbol : class userLogin
location: class jsp_servlet._login
user = (userLogin)pageContext.getAttribute("user"); //[ /login.jsp; Line: 9]
^
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:96: cannot resolve symbol
symbol : class userLogin
location: class jsp_servlet._login
user = new userLogin(); //[ /login.jsp; Line: 9]
^
4 errors
高手给点建议把!
欢迎登录系统
0)
response.sendRedirect("index.html");
else
response.sendRedirect("helloworld.html");
%>
我的javabean如下:
userLogin.java
import java.sql.*;
import java.rmi.*;
import javax.ejb.CreateException;
import javax.naming.*;
import javax.rmi.*;
public class userLogin{
private String accountID,password;
private int rsCount;
private accessDB connBean=null;
public userLogin(){
try{
InitialContext initial = new InitialContext();
Object objref = initial.lookup("connectionDB.accessDB"); accessDBHome home =(accessDBHome)PortableRemoteObject.narrow(objref,accessDBHome.class);
connBean = home.create();
}catch(NamingException ne){
System.out.println("naming Exception caught:"+ne);
}catch(CreateException ce){
System.out.println("Create Exception caught:"+ce);
}catch(RemoteException re){
System.out.println("Remote Exception caught:"+re);
}
}
public void setAccountID(String accountID){
this.accountID=accountID;
}
public void setPassword(String password){
this.password=password;
}
public int getRsCount(){
//Get the number of resultset through the accessDB
setRsCount();
return this.rsCount;
}
private void setRsCount(){
String sqlSelect="select * from Users where Username='"+accountID+"' and Password='"+password+"'";
try{
rsCount=connBean.rsCount(sqlSelect);
}catch(RemoteException re){
System.out.println("Remote Exception caught:"+re);
}catch(SQLException se)
{
System.out.println("sqlexception caught :"+se);
}
}
}
我的ejb已经配置好了,userLogin.class文件是在weblogic6.1下Gradesweb-infclasses目录中,.jsp文件在Grades下,
现在的问题是,运行。jsp文件,出现如下问题:
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:90: cannot resolve symbol
probably occurred due to an error in /login.jsp line 9:
Full compiler error(s):
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:90: cannot resolve symbol
symbol : class userLogin
location: class jsp_servlet._login
userLogin user = null; //[ /login.jsp; Line: 9]
^
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:91: cannot resolve symbol
symbol : class userLogin
location: class jsp_servlet._login
user = (userLogin)pageContext.getAttribute("user"); //[ /login.jsp; Line: 9]
^
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:94: cannot resolve symbol
symbol : class userLogin
location: class jsp_servlet._login
user = (userLogin)pageContext.getAttribute("user"); //[ /login.jsp; Line: 9]
^
E:beawlserver6.1configmydomainapplicationsGradesWEB-INF_tmp_war_myserver_myserver_Gradesjsp_servlet_login.java:96: cannot resolve symbol
symbol : class userLogin
location: class jsp_servlet._login
user = new userLogin(); //[ /login.jsp; Line: 9]
^
4 errors
高手给点建议把!
|
你写的是javabean,怎么能够象EJB一样配置在web-infclasses下哪?应该放在classpath下
|
ejb很不好用,有时错误提示也很难判断的!!
|
up