*/
protected ActionForward doCreateLink(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
LinkForm lform = (LinkForm)form;
super.validateClientId(request, lform);
ActionMessages msgs = new ActionMessages();
if(StringUtils.isEmpty(lform.getTitle())){
msgs.add("title", new ActionMessage("error.link_title_empty"));
}
else if(StringUtils.isEmpty(lform.getUrl())){
msgs.add("url", new ActionMessage("error.link_url_empty"));
}
else{
LinkBean lbean = new LinkBean();
lbean.setCreateTime(new Date());
lbean.setSiteId(lform.getSid());
lbean.setTitle(lform.getTitle());
lbean.setUrl(lform.getUrl());
lbean.setType(lform.getType());
lbean.setStatus(lform.getStatus());
try{
LinkDAO.create(lbean, lform.getId(), (lform.getDirection()==1));
}catch(Exception e){
msgs.add("link", new ActionMessage("error.database", e.getMessage()));
}
}
if(!msgs.isEmpty())
return mapping.getInputForward();
return makeForward(mapping.findForward("links"), lform.getSid());
}