先當然是簡單的配置web
<?xml version=
<web
<servlet>
<servlet
<servlet
</servlet>
<servlet>
<servlet
<servlet
<init
<param
<param
</init
<init
<param
<param
</init
<init
<param
<param
</init
<load
</servlet>
<servlet
<servlet
<url
</servlet
<servlet
<servlet
<url
</servlet
<welcome
<welcome
</welcome
</web
Struts
<?xml version=
<!DOCTYPE struts
<struts
<data
<form
<form
</form
<global
<global
<forward name=
<forward name=
<forward name=
</global
<action
<action
attribute=
input=
name=
path=
scope=
type=
</action
<message
</struts
view plaincopy to clipboardprint?
<?xml version=
<web
<servlet>
<servlet
<servlet
</servlet>
<servlet>
<servlet
<servlet
<init
<param
<param
</init
<init
<param
<param
</init
<init
<param
<param
</init
<load
</servlet>
<servlet
<servlet
<url
</servlet
<servlet
<servlet
<url
</servlet
<welcome
<welcome
</welcome
</web
Struts
<?xml version=
<!DOCTYPE struts
<struts
<data
<form
<form
</form
<global
<global
<forward name=
<forward name=
<forward name=
</global
<action
<action
attribute=
input=
name=
path=
scope=
type=
</action
<message
</struts
<?xml version=
<web
<servlet>
<servlet
<servlet
</servlet>
<servlet>
<servlet
<servlet
<init
<param
<param
</init
<init
<param
<param
</init
<init
<param
<param
</init
<load
</servlet>
<servlet
<servlet
<url
</servlet
<servlet
<servlet
<url
</servlet
<welcome
<welcome
</welcome
</web
Struts
<?xml version=
<!DOCTYPE struts
<struts
<data
<form
<form
</form
<global
<global
<forward name=
<forward name=
<forward name=
</global
<action
<action
attribute=
input=
name=
path=
scope=
type=
</action
<message
</struts
<html xmlns=
<head>
<meta http
<title>登錄頁面</title>
<style type=
<!
<!
</style>
</head>
<body>
<form id=
<label>用戶名
<input type=
</label>
<p>
<label>密 碼
<input type=
</label>
</p>
<p>
<label>
<input type=
</label>
</p>
</form>
#if($isSuccess)<p class=
#if($isNull)<p class=
</body>
</html>
view plaincopy to clipboardprint?
<html xmlns=
<head>
<meta http
<title>登錄頁面</title>
<style type=
<!
<!
</style>
</head>
<body>
<form id=
<label>用戶名
<input type=
</label>
<p>
<label>密 碼
<input type=
</label>
</p>
<p>
<label>
<input type=
</label>
</p>
</form>
#if($isSuccess)<p class=
#if($isNull)<p class=
</body>
</html>
<html xmlns=
<head>
<meta http
<title>登錄頁面</title>
<style type=
<!
<!
</style>
</head>
<body>
<form id=
<label>用戶名
<input type=
</label>
<p>
<label>密 碼
<input type=
</label>
</p>
<p>
<label>
<input type=
</label>
</p>
</form>
#if($isSuccess)<p class=
#if($isNull)<p class=
</body>
</html>還有一個後台處理的LoginAction
public ActionForward execute(ActionMapping mapping
HttpServletRequest request
LoginForm loginForm = (LoginForm) form;// TODO Auto
String userName = loginForm
String password = loginForm
if(userName
{
isSuccess = true;
request
}else if(userName==
{
boolean isNull = true;
request
return mapping
}
return mapping
}
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28282.html