- 论坛徽章:
- 0
|
(1) 在tomcat/webapp/中建立一个context(上下文)(tomcat/webapp/webwork);
将webwork中的webwork_2.1.5.jar和/lib/core中的所有.jar文件
加入到tomcat/webapp/webwork/web-info/lib中;
(1) 在tomcat/webapp/中建立一个context(上下文)(tomcat/webapp/webwork);
将webwork中的webwork_2.1.5.jar和/lib/core中的所有.jar文件
加入到tomcat/webapp/webwork/web-info/lib中;
(2) 修改web.xml如下:
webwork
com.opensymphony.webwork.dispatcher.ServletDispatcher
1
webwork
*.action
webwork
/WEB-INF/lib/webwork-2.1.5.jar
(3)在webwork/classes中加入xwork.xml配置文件:
index.jsp
success.jsp
(4)创建HelloAction.java文件(HelloAction 类是用来处理请求的):
package org;
import com.opensymphony.xwork.ActionSupport;
public class HelloAction extends ActionSupport {
String person;
public String getPerson() {
return person;
}
public void setPerson(String person) {
this.person = person;
}
public String execute() throws Exception {
if ((person == null) || (person.length() == 0)) return ERROR;
else return SUCCESS;
}
}
(5)创建两个jsp组件:index.jsp和success.jsp
index.jsp:
WebWork Tutorial
What's your name?
success.jsp:
WebWork Tutorial
Hello,
(6)运行!
tomcat---webapp
---webwork
---classes
---org.HelloAction
---xwork.xml
---lib(存放webwork工作的包)
---web.xml
---index.jsp
---success.jsp
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/8659/showart_37819.html |
|