String button;
button = request.getParameter("button");
if(button != null){
if(button.equals("Log side effect")){
try{
LogSideForm form = formBeanFactory.create(request);
request.setAttribute("logsideform", form);
if(!form.isPresent()){
return "homepage.jsp";
}
HttpSession session = request.getSession(false);
//check the errors.
errors.addAll(form.getValidationErrors());
if (errors.size()!= 0) {
sidelist = sideDAO.getSideEffectsList(user.getEmailAddress());
request.setAttribute("sideeffectslist",sidelist);
request.setAttribute("errors",errors);
return "logSide.jsp";
}
System.out.println("the loged sideeffect name is " + form.getName());
String delMed = (String) session.getAttribute("deletid");
String newMed;
//if user want some medication schedule be deleted.
if(delMed != null){
newMed = delMed;