分类: 系统运维
2012-01-20 14:15:19
用到了9个jar包,如图。红色圈的为容易漏加的。
package com.shengsiyuan.struts2;
public class LoginAction
{
private String username ;
private String password;
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String execute()
{
return "SUCCESS" ;
}
}
struts.xml
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"">
struts.xml控制着总流程:(login.jsp中:
result.jsp
<%@ page language="java" pageEncoding="ISO-8859-1"%>
附1_头文件中引用的DTD部分内容:
name CDATA #REQUIRED
extends CDATA #IMPLIED
namespace CDATA #IMPLIED
abstract CDATA #IMPLIED
externalReferenceResolver NMTOKEN #IMPLIED
>
name CDATA #REQUIRED
class CDATA #REQUIRED
default (true|false) "false"
>
name CDATA #REQUIRED
class CDATA #REQUIRED
>
name CDATA #REQUIRED
>
name CDATA #REQUIRED
>
name CDATA #REQUIRED
>
name CDATA #REQUIRED
>
class CDATA #REQUIRED
>
name CDATA #REQUIRED
class CDATA #IMPLIED
method CDATA #IMPLIED
converter CDATA #IMPLIED
>
name CDATA #REQUIRED
>
name CDATA #IMPLIED
type CDATA #IMPLIED
>
name CDATA #IMPLIED
exception CDATA #REQUIRED
result CDATA #REQUIRED
>
file CDATA #REQUIRED
>
type CDATA #IMPLIED
name CDATA #IMPLIED
class CDATA #REQUIRED
scope CDATA #IMPLIED
static CDATA #IMPLIED
optional CDATA #IMPLIED
>
name CDATA #REQUIRED
value CDATA #REQUIRED
>
附2_struts-default.xml
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"">
dojo\..*,^struts\..*
dojo\..*,^struts\..*
dojo\..*,^struts\..*
input,back,cancel,browse
input,back,cancel,browse
dojo\..*,^struts\..*
input,back,cancel,browse
input,back,cancel,browse
input,back,cancel
input,back,cancel