⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loginexec.java

📁 BEA WebLogic Server 8.1大全 = BEA webLogic server 8.1 unleashed (美) Mark Artiges等著 袁毅 ... [等] 译 eng
💻 JAVA
字号:
package myApp.Action;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import java.util.Hashtable;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

public class LoginExec extends Action {

public ActionForward
       execute(ActionMapping mapping,
               ActionForm form,
               HttpServletRequest request,
               HttpServletResponse response) throws Exception {
/* Example code if the user enters in 1234 for CustomerNo and password
 * the page will be forwarded to orderlistentry else an action error is added
 * displayed back to the front page
 */
               HttpSession session = request.getSession();
        if("1234".equals(request.getParameter("customerNo")) && "1234".equals(request.getParameter("password"))){
                   request.getSession().setAttribute("order",new java.util.Vector());
                   request.getSession().setAttribute("user",request.getParameter("customerNo"));
                return mapping.findForward("success");
        }

        //add an error to be displayed at the front page
        ActionErrors errors = new ActionErrors();
        errors.add("loginerror", new ActionError("error.invalid.login", request.getParameter("customerNo")));

        super.saveErrors(request, errors);
        return mapping.getInputForward();



}
}//end of LoginExec

⌨️ 快捷键说明

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