@Override public ActionForward executeSub(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  ActionErrors errors=new ActionErrors();
  String forward="readposts";
  String reqCategory=cleanNull(request.getParameter("cat"));
  PersonalBlogService pblog=PersonalBlogService.getInstance();
  try {
    if (!reqCategory.equals("")) {
      request.setAttribute("posts",pblog.getPostsByCategory(reqCategory));
    }
 else {
      request.setAttribute("posts",pblog.getPosts());
    }
  }
 catch (  ServiceException e) {
    ActionMessages messages=new ActionMessages();
    ActionMessage message=new ActionMessage("exception.postdoesnotexist");
    messages.add(ActionMessages.GLOBAL_MESSAGE,message);
    errors.add(messages);
    e.printStackTrace();
  }
  if (!errors.isEmpty()) {
    saveErrors(request,errors);
  }
  return (mapping.findForward(forward));
}

@ Override public ActionForward executeSub ( ActionMapping mapping , ActionForm form , HttpServletRequest request , HttpServletResponse response ) throws Exception { ActionErrors errors = new ActionErrors ( ) ; String forward = "readposts" ; String reqCategory = cleanNull ( request . getParameter ( "cat" ) ) ; PersonalBlogService pblog = PersonalBlogService . getInstance ( ) ; try { if ( ! reqCategory . equals ( "" ) ) { request . setAttribute ( "posts" , pblog . getPostsByCategory ( reqCategory ) ) ; } else { request . setAttribute ( "posts" , pblog . getPosts ( ) ) ; } } catch ( ServiceException e ) { ActionMessages messages = new ActionMessages ( ) ; ActionMessage message = new ActionMessage ( "exception.postdoesnotexist" ) ; messages . add ( ActionMessages . GLOBAL_MESSAGE , message ) ; errors . add ( messages ) ; e . printStackTrace ( ) ; } if ( ! errors . isEmpty ( ) ) { saveErrors ( request , errors ) ; } return ( mapping . findForward ( forward ) ) ; }
process the specified http request , and create the corresponding http response ( or forward to another web component that will create it ) . return an actionforward instance describing where and how control should be forwarded , or null if the response has already been completed .
