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 阅读(147)
评论(0) 编辑 收藏 所属分类:
struts