indexaction.java

来自「地方划时代反函数的地方划时代反函数的地方划时代反函数的地方划时代反函数的」· Java 代码 · 共 45 行

JAVA
45
字号
package Index.Action;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import Index.Form.IndexActionForm;
import org.apache.struts.action.Action;
import Tool.DBA.GetConn;
import java.sql.Connection;

public class IndexAction
    extends Action {
  public ActionForward execute(ActionMapping actionMapping,
                               ActionForm actionForm,
                               HttpServletRequest servletRequest,
                               HttpServletResponse servletResponse) {
    GetConn gc = new GetConn();
    Connection conn = gc.getConnection();





    IndexActionForm iaf = (IndexActionForm) actionForm;
    String username = "";
    String password = "";
    try {
      username = iaf.getUsername();
      password = iaf.getPassword();
      if (username.trim().equals(password)) {
        return actionMapping.findForward("main");
      }
      else {
        return actionMapping.findForward("error");
      }
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
    return null;
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?