Posted on 2006-06-04 09:13
shaofan 阅读(2290)
评论(7) 编辑 收藏 所属分类:
Java
适用于webwork 2.2.2,详见随包文档。源文件下载:
Hello.rar一共五步:
1.建立web应用程序的目录结构
2.拷贝库文件:ww安装目录下的lib\default中的所有jar,以及webwork-2.2.2.jar,复制到WEB-INF\lib下。
3.生成配置文件:web.xml在WEB-INF下, xwork.xml在WEB-INF\classes下
web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!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>My First Hello Webwork</display-name>
<filter>
<filter-name>webwork</filter-name>
<filter-class>com.opensymphony.webwork.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>webwork</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/webwork</taglib-uri>
<taglib-location>/WEB-INF/lib/webwork-2.2.2.jar</taglib-location>
</taglib>
</web-app>
xwork.xml:
<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.1.1//EN" "http://www.opensymphony.com/xwork/xwork-1.1.1.dtd">
<xwork>
<!-- Include webwork defaults (from WebWork JAR). -->
<include file="webwork-default.xml" />
<!-- Configuration for the default package. -->
<package name="default" extends="webwork-default">
</package>
</xwork>
4. 编写action和jsp
5. 在xwork.xml中添加相应配置,如在package之间加入:
<default-interceptor-ref name="completeStack"/>
<action name="helloww" class="net.blogjava.shaofan.helloww.Hello">
<result name="success">greetings.jsp</result>
</action>
下步计划:
* 了解package
* ww的taglibs
* 在action和jsp间传递数据的机制(struts中使用formbean,利用session,request等)