freefly
一门技术,如果不能讲出来,那么就是没有理解,如果不能很好的讲出来,那么就是理解不够透彻!
posts - 9,comments - 3,trackbacks - 0
1.
LoginAction.java
public class LoginAction extends Action {
    public ActionForward execute(
                             ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
                                    throws Exception {
        String username = ((UserForm) form).getUsername();
        String password = ((UserForm) form).getPassword();
       
        request.setAttribute("username", username);
       
        if(username.equals("freefly") &&
                  password.equals("whl")) {
            return mapping.findForward("helloUser");
        }
       
        return mapping.findForward("loginFail");
    }
}
2.hello.jsp
<html> 
<head>
<title>Hello, ${username} !</title>
</head>
<body>
<H1>Hello, ${username} !</H1>
<H1>This is your secret gift!!</H1>
</body>
</html>

posted on 2006-04-29 13:14 freefly 阅读(146) 评论(0)  编辑  收藏 所属分类: struts

只有注册用户登录后才能发表评论。


网站导航: