Struts2中的變數

2021-09-06 15:57:36 字數 2276 閱讀 1212

1

<

package

name

="mypackage"

extends

="struts-default"

>

2<

global-results

>

3<

result

name

="error"

>/success.jsp

result

>

4global-results

>

其它包 extends="mypackage" 就可以用到它裡面的引數了

常量

1

<

constant

name

="struts.devmode"

value

="true"

>

constant

>

2<

constant

name

="struts.i18n.encoding"

value

="utf-8"

>

constant

>

3<

constant

name

="struts.action.extension"

value

="action,,do"

>

constant

>

4<

constant

name

="struts.serve.static.browsercache"

value

="false"

>

constant

>

5<

constant

name

="struts.enable.dynamicmethodinvocation"

value

="false"

>

constant

>

6<

constant

name

="struts.multipart.maxsize"

value

="52428800"

>

constant

>

struts2中每個請求都區域性建立乙個變數執行的,所以是執行緒安全的

匯入其他檔案的 配置,為了解決action配置太多 看的花

struts.xml中關閉動態呼叫 ,!後面就是動態呼叫

//(不建議使用)動態方法呼叫:http://localhost:8080/struts2day02/customer/addcustomer!updatecustomer(應該執行addcustomer,使用!updatecustomer,在請求addcustomer就執行了updatecustomer)

//關閉動態呼叫的功能:struts.enable.dynamicmethodinvocation = false

代表前面的*

1

<

action

name

="orders_*"

class

="cn.itcast.action.ordersaction"

method

="">

2<

result

type

="dispatcher"

name

="success"

>/orders/.jsp

result

>

3<

result

type

="dispatcher"

name

="input"

>/orders/.jsp

result

>

4action

>

5

struts 會根據 變數是否存在,如果不存在會建立乙個例項變數 並且賦值。例如

public class customer

string id;

address  a;

set()get()省略

框架會new出 address並且賦值

jsp中

jsp中

類設計中class

stringhobby;

actioncontext.getcontext() 可以用於獲取action上下文

Struts2中的變數

1 package name mypackage extends struts default 2 global results 3 result name error success.jsp result 4global results 其它包 extends mypackage 就可以用到它裡面...

Struts2中checkboxlist標籤的使用

selectedproducts name product.id list products listvalue name listkey id value 這裡分兩類,首先明確value的值應該是乙個list,用來顯示checkbox內那些需要先打勾 一類,當value的值是是乙個list bea...

Struts2字尾 深入Struts2

一 將action字尾變成html字尾 xmlversion 1.0 encoding utf 8 doctype struts public apache software foundation dtd struts configuration 2.1 en struts include file...