========================================= <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %> ======================================= ================================== ================================== ==================================== <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %> <%@ page contentType="text/html;charset=MS950"%> Employee Info. JSP ======================================= ========================================== <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %> <%@ page contentType="text/html;charset=MS950"%> Employee Info. JSP
========================================= ========================================== Note: Bc4j.css 為Oracle9i JDeveloper內建的bc4j.css,存放在\jdev\system9.0.3.1035\templates\common\misc目錄下。 =================================================== ============================================== <%@ page contentType="text/html;charset=MS950"%> Login Page

======================================= ============================= ================================== ================================= ============================== ================================================== =================================== ======================================

User ID:


Password:

=================================== ===================================== <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ page contentType="text/html;charset=big5"%> Login Page

Login Page

================================= =========================================== <%@ page contentType="text/html;charset=MS950"%> Login Success Page

Login Successfully!

========================================== =================================== <%@ page contentType="text/html;charset=MS950"%> Login Faliure Page

Login Faliure!

===================================== ================================== ==================================== 4 ========================================== public ActionErrors validate( ActionMapping mapping,                   HttpServletRequest request) { ActionErrors err = new ActionErrors(); if ((userid == null) || (userid.length()<1)) err.add("userid",new ActionError("error.userid.missed")); if ((password == null)|| (password.length()<1)) err.add("password",new ActionError("error.password.missed")); return err; } ==================================== ================================= ==================================== ============================================== public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)  throws IOException, ServletException { LoginForm loginForm = (LoginForm) form; String userid = loginForm.getUserid(); String password = loginForm.getPassword(); if ( userid.equals("scott") && password.equals("tiger")) return mapping.findForward("success"); else return mapping.findForward("faliure"); } ====================================== ====================================== index.title=JDeveloper Struts Application index.heading=JDeveloper Struts Application index.message=See how easy it is to use struts with JDeveloper 9i. userid.prompt=User ID: password.prompt=Password: error.userid.missed=
  • User ID is missed !
  • error.password.missed=
  • Password is missed!
  • ======================================