配置ActionMapping
ActionMapping对象帮助进行框架内部的流程控制,它们可将请求URI映射到Action类,并且将Action类与ActionForm bean相关联。ActionServlet在内部使用这些映射,并将控制转移到特定Action类的实例。所有Action类使用perform()方法实现特定应用程序代码,返回一个ActionForward对象,其中包括响应转发的目标资源名称。例如:
type="BookAction"
name="bookForm"
scope="request"
input="/CreateBook.jsp">
"failure" path="/CreateBook.jsp"/>
"cancel" path="/index.jsp"/>
属性
|
描述
|
Path
|
Action
类的相对路径
|
Name
|
与本操作关联的
Action bean
的名称
|
Type
|
连接到本映射的
Action
类的全称(可有包名)
|
Scope
|
ActionForm bean
的作用域(请求或会话)
|
Prefix
|
用来匹配请求参数与
bean
属性的前缀
|
Suffix
|
用来匹配请求参数与
bean
属性的后缀
|
attribute
|
作用域名称。
|
className
|
ActionMapping对象的类的完全限定名
默认的类是
org.apache.struts.action.ActionMapping
|
input
|
输入表单的路径,指向
bean
发生输入错误必须返回的控制
|
unknown
|
设为
true
,操作将被作为所有没有定义的
ActionMapping
的
URI
的默认操作
|
validate
|
设置为
true
,则在调用
Action
对象上的
perform()
方法前,
ActionServlet
将调用
ActionForm bean
的
validate()
方法来进行输入检查
|