📄 scoresessionbean.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package demo;import javax.ejb.Stateless;import java.util.*;import com.eonline.model.*;import javax.annotation.PostConstruct;/** * * @author Administrator */@Statelesspublic class ScoreSessionBean implements ScoreSessionRemote { private int UID = 0; private List scoreList = null; private ScoreDAO dao = null; public ScoreSessionBean(){ } @PostConstruct public void init(){ this.dao = new ScoreDAO(); } public void ScoreSessionBean(int UID) { this.UID = UID; } //If scoreList is null,get data from DB. public List getScoreList() { if (scoreList == null) { scoreList = dao.getScoreList(UID); } return scoreList; } public Score addScore(int UID, java.sql.Timestamp date, int score, String answer, String s_answer) { Score scoreitem = new Score(UID, date, score, answer, s_answer); // Store in the database dao.addScore(UID, scoreitem); // Return the scoreitem to the client return scoreitem; } public Score addScore(Score score) { Score scoreitem = new Score(UID, score.getDate(), score.getScore(), score.getAnswer(), score.getS_answer()); // Store in the database dao.addScore(UID, scoreitem); // Return the scoreitem to the client return scoreitem; } // Add business logic below. (Right-click in editor and choose // "EJB Methods > Add Business Method" or "Web Service > Add Operation") }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -