📄 startstudentbean.java
字号:
package sessionEntity;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.math.*;
public class StartStudentBean implements SessionBean{
private SessionContext ctx;
public void setSessionContext(SessionContext sc){
ctx=sc;
}
public String HelloStudent(){
return "Hello StartStudent,Welcome!";
}
public Collection getAllStudents(int grade){
Vector vectUserInfos = new Vector();
try {
Context ctx = new InitialContext();
Object ref = ctx.lookup("StudentHome");
StudentHome studentHome = (StudentHome)
PortableRemoteObject.narrow(ref,StudentHome.class);
Collection collection = studentHome.findStudentsInGrade(grade);
Return collection;
} catch(Exception e) {
System.out.println("failed get All Students");
//e.printStackTrace();
}
}
public HelloEJBBean() {}
public void ejbCreate() {}
public void ejbRemove() {}
public void ejbActivate() {}
public void ejbPassivate() {}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -