String delMed = (String) session.getAttribute("deletid");
String newMed;
//if user want some medication schedule be deleted.
if(delMed != null){
newMed = delMed;
logSideMed = new SideEffectLog(Integer.parseInt(newMed));
logSideMed.setOwner(user.getEmailAddress());
createLogSide(logSideMed,form);
//create a new user.
logsideDAO.create(logSideMed);
//if no scheduled medication be deleted.
}else{
int allSize = logsideDAO.size();
//initialization situation.
if(allSize == 0){
newMed = Integer.toString(allSize);
logSideMed = new SideEffectLog(Integer.parseInt(newMed));
logSideMed.setOwner(user.getEmailAddress());
createLogSide(logSideMed,form);
//create a new user.
logsideDAO.create(logSideMed);
}else{
allSize = logsideDAO.getLastId();
newMed = Integer.toString(allSize);
logSideMed = new SideEffectLog(Integer.parseInt(newMed) + 1);
logSideMed.setOwner(user.getEmailAddress());
createLogSide(logSideMed,form);
//create a new user.
logsideDAO.create(logSideMed);
}