View Javadoc

1   /*
2    * Created on 2004/12/17
3    */
4   package org.ieee.shinobu.demo.velocity.ben;
5   
6   import javax.servlet.http.HttpServletRequest;
7   import javax.servlet.http.HttpServletResponse;
8   
9   import org.apache.struts.action.Action;
10  import org.apache.struts.action.ActionForm;
11  import org.apache.struts.action.ActionForward;
12  import org.apache.struts.action.ActionMapping;
13  import org.apache.struts.action.ActionMessage;
14  import org.apache.struts.action.ActionMessages;
15  
16  /***
17   * @author shinobu
18   */
19  public class BenAction extends Action {
20  
21  	/* (non-Javadoc)
22  	 * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
23  	 */
24  	public ActionForward execute(ActionMapping mapping, ActionForm form,
25  			HttpServletRequest request, HttpServletResponse response) throws Exception {
26  		BenActionForm benForm = (BenActionForm) form;
27  		
28  		ActionMessages errors = new ActionMessages();
29  		errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.detail", "error:"+benForm.getFoo()));
30  		this.saveErrors(request, errors);
31  
32  		ActionMessages messages = new ActionMessages();
33  		messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.detail", "message:"+benForm.getFoo()));
34  		this.saveMessages(request, messages);
35  
36  		return mapping.findForward("success");
37  	}
38  	
39  }