* @param userid The user's ID we want to obtain information of
* @return The user information wrapped into a bean
**/
private UserBean getUserInformation(int userid)
throws ServletException {
UserBean temp=new UserBean();
synchronized(this) {
try {
//request information
PreparedStatement stmt=DBInterface.doQuery("SELECT name,info,firstname,lastname FROM users WHERE id=?");
stmt.setInt(1,userid);
ResultSet result=stmt.executeQuery();
//store result
if (result.next()) {
temp.setId(userid);
temp.setName(result.getString("name"));
temp.setInfo(GlobalHelpers.nl2br(result.getString("info")));
temp.setFirstname(result.getString("firstname"));
temp.setLastname(result.getString("lastname"));
} else {
throw new ServletException("User with ID "+userid+" not found!");
}
result.close();