webwork最新版本 webwork 2.2.6环境配置过程
2007年12月25日 星期二 16:49
|
第一步:把webwork的jar包加到web project中(上网下包) 下载地址:http://www.opensymphony.com/webwork/ webwork-2.2.6\webwork-2.2.6.jar webwork-2.2.6\lib\default\*.jar 将以上包加到项目的lib文件夹 将webwork-2.2.6\src\java\webwork-default.xml加到项目的lib目录下 将webwork-2.2.6\src\java\META-INF\taglib.tld改名为webwork.tld加到项目的WEB-INF目录下 第二步:在web.xml中配置webwork
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"
>
<
web-app
>
![]()
<
display-name
>
WebWork 2.0 Example App
</
display-name
>
![]()
<
servlet
>
<
servlet-name
>
webwork
</
servlet-name
>
<
servlet-class
>
com.opensymphony.webwork.dispatcher.ServletDispatcher
</
servlet-class
>
</
servlet
>
![]()
<
servlet-mapping
>
<
servlet-name
>
webwork
</
servlet-name
>
<
url-pattern
>
*.action
</
url-pattern
>
</
servlet-mapping
>
![]() <taglib><taglib-uri>webwork</taglib-uri> <taglib-location>/WEB-INF/webwork.tld</taglib-location> </taglib>
</
web-app
>
第三步:新建action文件
package
com.jiangjing.action;![]()
import
com.opensymphony.xwork.Action;![]() ![]()
public
class
hellowordaction
implements
Action
...
{ private String name;![]() public String execute() throws Exception...{ name = "这是江静的第一个webwork!"; System.out.println("----"); return SUCCESS; } ![]() public String getName() ...{ return name; }![]() public void setName(String name) ...{ this.name = name; }![]() }
第四步:新建jsp
<%
@ page language
=
"
java
"
contentType
=
"
text/html; charset=GBK
"
pageEncoding
=
"
GBK
"
%>
<%
@taglib prefix
=
"
ww
"
uri
=
"
webwork
"
%>
<!
DOCTYPE HTML PUBLIC
"
-//W3C//DTD HTML 4.01 Transitional//EN
"
>
<
html
>
<
head
>
<
meta http
-
equiv
=
"
Content-Type
"
content
=
"
text/html; charset=GBK
"
/>
<
title
>
我的第一个webwork
</
title
>
</
head
>
![]()
<
body
>
<ww:property value="name"/>
</
body
>
</
html
>
![]()
</
element
>
第五步:添加webwork.properties到项目的src目录下
webwork.i18n.encoding=ISO-8859-1 webwork.locale=de_DE webwork.multipart.saveDir= emp webwork.multipart.maxSize=12345![]() ### Load custom property files (does not override webwork.properties!) webwork.custom.properties=test,com/opensymphony/webwork/othertest![]() # added the MockTag to the path of Tags that the TagDirective will search through webwork.velocity.tag.path = com.opensymphony.webwork.views.velocity.ui, org.displaytag.tags![]() webwork.ui.templateDir = template![]() ### Load custom default resource bundles webwork.custom.i18n.resources=testmessages,testmessages2![]() ### XSLT Cache webwork.xslt.nocache = true
第六步:添加xwork.xml到项目src目录
<!
DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" "http://www.opensymphony.com/xwork/xwork-1.0.dtd"
> <
xwork
> <
include
file
="webwork-default.xml"
/> <package
name="default" extends
="webwork-default"> <action
name
="helloworld"
class="com.jiangjing.action.hellowordaction"
> <
result
name
="success"
type
="dispatcher"
> <
param
name
="location"
>
/hello.jsp
</
param
> </
result
> </
action
>
</
package
> </
xwork
>
|
本文介绍如何部署WebWork2.2.6版本,包括添加必要的JAR包、配置web.xml、创建Action和JSP文件、设置属性文件及xwork.xml等内容。



}
}
2257

被折叠的 条评论
为什么被折叠?



