LogonAction.java
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:

Java编程

开发平台:

Java

  1. package firststrut;
  2. import org.apache.struts.action.*;
  3. import javax.servlet.http.*;
  4. import javax.servlet.*;
  5. public class LogonAction extends Action {
  6.   public ActionForward perform(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) {
  7.     //cast to LogonForm
  8.     LogonForm lgForm=(LogonForm)actionForm;
  9.     //
  10.     String username=lgForm.getUsername();
  11.     String password=lgForm.getPassword();
  12.     //apply the biz logic
  13.     if(username.equals("cwj")&& password.equals("cwj")){
  14.       //return actionForward for success
  15.       return (actionMapping.findForward("success"));
  16.     }else{
  17.      return actionMapping.findForward(actionMapping.getInput());
  18.     }
  19.   }
  20. }