Skynet
posts - 165, comments - 198, trackbacks - 0, articles - 1
BlogJava
::
首頁
::
新隨筆
::
聯(lián)系
::
聚合
::
管理
struct 2 apps 學(xué)習(xí)(1)
Posted on 2008-04-21 17:51
G_G
閱讀(1213)
評論(0)
編輯
收藏
所屬分類:
struct
struts2-blank-2.0.11.1.war
web.xml:
<?
xml?version="1.0"?encoding="UTF-8"
?>
<
web-app?
id
="WebApp_9"
?version
="2.4"
?xmlns
="http://java.sun.com/xml/ns/j2ee"
?xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
?xsi:schemaLocation
="http://java.sun.com/xml/ns/j2ee?http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>
????
<
display-name
>
Struts?Blank
</
display-name
>
????
<
filter
>
????????
<
filter-name
>
struts2
</
filter-name
>
????????
??? <!--
?struct?2?處理類?
-->
??? <!--
相應(yīng)需要jar:
??? ??? ??? ??? commons-logging-1.0.4.jar
??? ?? ?? ?? ?? freemarker-2.3.8.jar
??? ?? ?? ?? ?? ognl-2.6.11.jar
??? ??? ??? ??? struts2-core-2.0.11.1.jar
??? ?? ?? ?? ?? xwork-2.0.4.jar
??? -->
<
filter-class
>
org.apache.struts2.dispatcher.FilterDispatcher
</
filter-class
>
</
filter
>
????
<!--
??默認(rèn)覆蓋
全部
路徑?
-->
????
<
filter-mapping
>
????????
<
filter-name
>
struts2
</
filter-name
>
????????
<
url-pattern
>
/*
</
url-pattern
>
????
</
filter-mapping
>
????
<!--
?初始頁面?
-->
????
<
welcome-file-list
>
????????
<
welcome-file
>
index.html
</
welcome-file
>
????
</
welcome-file-list
>
</
web-app
>
index.html:
??? <
head
>
??? ???
<!--
?利用html?跳轉(zhuǎn)?
-->
??? ???
<
META?
HTTP-EQUIV
="Refresh"
?CONTENT
="0;URL=example/HelloWorld.action"
>
??? </
head
>
struct.xml
???
<!--
?模塊化注入??
-->
???
<
include?
file
="example.xml"
/>
????
<!--
?Add?packages?here?
-->
????
example.xml
<?
xml?version="1.0"?encoding="UTF-8"?
?>
<!
DOCTYPE?struts?PUBLIC
????????"-//Apache?Software?Foundation//DTD?Struts?Configuration?2.0//EN"
????????"http://struts.apache.org/dtds/struts-2.0.dtd"
>
<
struts
>
????
<!--
?定義域空間?
-->
????
<
package?
name
="example"
?namespace
="/example"
?extends
="struts-default"
>
????????
<!--
?域一般訪問?
-->
????????
<
action?
name
="HelloWorld"
?class
="example.HelloWorld"
>
????????????
<
result
>
/example/HelloWorld.jsp
</
result
>
????????
</
action
>
<!--
HelloWord.java(國際化) start -->
?1
?
package
?example;
?2
?
?3
?
/**
?4
?
?*?import?com.opensymphony.xwork2.ActionSupport;
?5
?
?6
?
public?class?ExampleSupport?extends?ActionSupport?{
?7
?
?
*/
?8
?
public
?
class
?HelloWorld?
extends
?ExampleSupport?{
?9
?
10
?
????
//
默認(rèn)方法
11
?
????
public
?String?execute()?
throws
?Exception?{
12
?
????????
//
國際化方法使用?getText(?key?)
13
?
????????
//
?在url中體現(xiàn)->>?HelloWorld.action?request_locale=en/es
14
?
????????
//
國際化配置文件文件?package.properties和package_es.properties
15
?
????????setMessage(getText(MESSAGE));
16
?
????????
return
?SUCCESS;
17
?
????}
18
?
19
?
????
/**
20
?
?????*?Provide?default?valuie?for?Message?property.
21
?
?????
*/
22
?
????
public
?
static
?
final
?String?MESSAGE?
=
?
"
HelloWorld.message
"
;
23
?
24
?
????
/**
25
?
?????*?Field?for?Message?property.
26
?
?????
*/
27
?
????
private
?String?message;
28
?
29
?
????
/**
30
?
?????*?Return?Message?property.
31
?
?????*
32
?
?????*?
@return
?Message?property
33
?
?????
*/
34
?
????
public
?String?getMessage()?{
35
?
????????
return
?message;
36
?
????}
37
?
38
?
????
/**
39
?
?????*?Set?Message?property.
40
?
?????*
41
?
?????*?
@param
?message?Text?to?display?on?HelloWorld?page.
42
?
?????
*/
43
?
????
public
?
void
?setMessage(String?message)?{
44
?
????????
this
.message?
=
?message;
45
?
????}
46
?
}
<!--
HelloWord.java(國際化) end-->
???????
<!--
?(關(guān)鍵:action利用正則選擇方法)Login(_*)? >method="{1}"?
-->
????????
<
action?
name
="Login_*"
?method
="{1}"
?class
="example.Login"
>
????????????
<
result?
name
="input"
>
/example/Login.jsp
</
result
>
????????????
<
result?
type
="redirect-action"
>
Menu
</
result
>
????????
</
action
>
<!-
- example.Login(驗(yàn)證框架) start -->
java
?1
?
public
?
class
?Login?
extends
?ExampleSupport?{
?2
?
?3
?
????
public
?String?execute()?
throws
?Exception?{
?4
?
?5
?
????????
if
?(isInvalid(getUsername()))?
return
?INPUT;
?6
?
?7
?
????????
if
?(isInvalid(getPassword()))?
return
?INPUT;
?8
?
?9
?
????????
return
?SUCCESS;
10
?
????}
11
?
12
?
????
private
?
boolean
?isInvalid(String?value)?{
13
?
????????
return
?(value?
==
?
null
?
||
?value.length()?
==
?
0
);
14
?
????}
Login-validation.xml
?1
?
<!
DOCTYPE?validators?PUBLIC
?2
?
????????"-//OpenSymphony?Group//XWork?Validator?1.0.2//EN"
?3
?
????????"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"
>
?4
?
?5
?
<
validators
>
?6
?
????
<
field?
name
="username"
>
?7
?
????????
<
field-validator?
type
="requiredstring"
>
?8
?
????????????
<
message?
key
="requiredstring"
/>
?9
?
????????
</
field-validator
>
10
?
????
</
field
>
11
?
????
<
field?
name
="password"
>
12
?
????????
<
field-validator?
type
="requiredstring"
>
13
?
????????????
<
message?
key
="requiredstring"
/>
14
?
????????
</
field-validator
>
15
?
????
</
field
>
16
?
</
validators
>
17
?
<!-
- example.Login(驗(yàn)證框架) end -->
????????
<!--
?jsp?封包 如:Missing.action就是Missiong.jsp
-->
????????
<
action?
name
="*"
?class
="example.ExampleSupport"
>
????????????
<
result
>
/example/{1}.jsp
</
result
>
????????
</
action
>
????????
<!--
?Add?actions?here?
-->
????
</
package
>
</
struts
>
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
struts2 ognl
struct 2 apps 學(xué)習(xí)(1)
Struts validation 小例
struts
Powered by:
BlogJava
Copyright © G_G
日歷
<
2008年4月
>
日
一
二
三
四
五
六
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
公告
由于時(shí)間問題,
blog上一些表達(dá)都不太好。
在此我盡量把我參考的原文給大家,
與大家學(xué)習(xí)。^_^
最近在維護(hù)m.tkk7.com\Skynet 腳本中
有什么技術(shù)問題不會,
我很愿意和大家討論!
多交流快成長
liukaiyi@gmail.com
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(13)
給我留言
查看公開留言
查看私人留言
隨筆分類
ant(6)
AOP(5)
Database(9)
E_Study(3)
EJB(4)
hibernate(25)
HTML(4)
Inspiration(11)
Jakarta Commons(3)
javaGeneral(28)
javascript(28)
javascript Framework(7)
JDBC(5)
json(3)
JspTag(12)
JUnit(8)
Other(5)
Reportform(3)
Spring(4)
struct(5)
Swing(1)
xml Related(7)
隨筆檔案
2009年4月 (1)
2009年2月 (2)
2009年1月 (1)
2008年12月 (4)
2008年11月 (1)
2008年9月 (7)
2008年8月 (8)
2008年7月 (12)
2008年6月 (9)
2008年5月 (5)
2008年4月 (11)
2008年3月 (6)
2008年1月 (8)
2007年12月 (13)
2007年11月 (13)
2007年10月 (15)
2007年9月 (11)
2007年8月 (9)
2007年7月 (7)
2007年6月 (6)
2007年5月 (3)
2007年4月 (9)
文章檔案
2007年4月 (1)
相冊
EJB
hbn
ss
wz
hibernate
cjdbc
hibernate.cache
Hibernate中outer-join、lazy 、fetch join關(guān)鍵字的使用
My連接
一個(gè)讀取Gmail郵件的簡單程序
bat 1%
eXtremeTable limit
java+web
jsp java javascrip 交互
JS函數(shù)集合大全
strut c:
Struts Menu
tree jsp
上手JFreeChart
關(guān)鍵筆記
根據(jù)name調(diào)用getName方法
用JAVA實(shí)現(xiàn)一個(gè)分頁類
搜索
最新評論
1.?re: 序列化和反序列化對象到 數(shù)據(jù)庫
qwe
--erwqe
2.?re: 部分高級查詢 sql 拼寫筆記 (mysql)
說實(shí)話,寫的的的確是差了那么一點(diǎn)點(diǎn)
--老衲用飄柔
3.?re: html 簡單 div 拖動(dòng)
好。
--火星華人
4.?re: hibernate 多服務(wù)器數(shù)據(jù)同步問題(支持延遲同步)
評論內(nèi)容較長,點(diǎn)擊標(biāo)題查看
--張久強(qiáng)
5.?re: 數(shù)據(jù)庫表地址數(shù)據(jù)(中國地區(qū))
謝謝分享,收藏了!
--久久快樂鮮花
閱讀排行榜
1.?google svn 服務(wù)器使用(14266)
2.?mysql 權(quán)限控制筆記(11670)
3.?mysql 游標(biāo)使用(7120)
4.?強(qiáng)大的 ant scp 和 sshexec (6388)
5.?CGLib 學(xué)習(xí)(5783)
評論排行榜
1.?hibernate 多服務(wù)器數(shù)據(jù)同步問題(支持延遲同步)(12)
2.?部分高級查詢 sql 拼寫筆記 (mysql)(9)
3.?為在平安夜還在加班的程序員祝福!(8)
4.?原創(chuàng)小框架: 動(dòng)態(tài)面向?qū)ο髷?shù)據(jù)庫操作(不要影射類哦)(6)
5.?自用小框架:DB工廠(6)
主站蜘蛛池模板:
亚洲情侣偷拍精品
|
亚洲AV无码国产精品色
|
91av视频免费在线观看
|
在线观看亚洲AV日韩A∨
|
亚洲国产中文字幕在线观看
|
免费的全黄一级录像带
|
亚洲中文字幕无码爆乳app
|
国产国拍精品亚洲AV片
|
日本免费人成视频播放
|
扒开双腿猛进入爽爽免费视频
|
男男黄GAY片免费网站WWW
|
内射干少妇亚洲69XXX
|
免费观看男人免费桶女人视频
|
a毛片免费全部播放完整成
|
亚洲欧美第一成人网站7777
|
亚洲国产精彩中文乱码AV
|
日本v片免费一区二区三区
|
一级毛片全部免费播放
|
香港经典a毛片免费观看看
|
亚洲黑人嫩小videos
|
亚洲国产一区二区三区
|
99精品全国免费观看视频
|
日本人成在线视频免费播放
|
亚洲AV无码成人网站在线观看
|
亚洲国产一区二区a毛片
|
亚洲国产精品一区二区第四页
|
中文字幕乱码免费视频
|
国产麻豆成人传媒免费观看
|
亚洲精品av无码喷奶水糖心
|
亚洲天堂电影在线观看
|
亚洲成AV人在线播放无码
|
国产亚洲av片在线观看18女人
|
手机在线免费视频
|
免费观看美女用震蛋喷水的视频
|
丁香花在线观看免费观看图片
|
久久精品无码一区二区三区免费
|
免费毛片在线看不用播放器
|
色一情一乱一伦一视频免费看
|
亚洲午夜一区二区三区
|
亚洲AV综合色区无码一区爱AV
|
亚洲中文字幕视频国产
|