- 浏览: 202825 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
maxrocray:
现在没管用的了。。。
google的IP地址列表 -
greenwen:
谢谢您的分析,学习受教了
几种通讯协议的比较 -
chaiying:
...
几种通讯协议的比较 -
liyan12167:
哥们 我想向您请教些更详细的内容 不知道你还会在上线不 上来 ...
什么是SyncML -
追求幸福:
...
SyncML相关资源链接
任何结果都是由简单的实践得出的,当然我下面的介绍也是模仿那些大牛们,下面WebWork的介绍也是从古老而经典的HelloWorld开始。
在今天,各种各样的框架让我们眼花缭乱,但我始终坚信一点:“存在就是合理的”(黑格尔之哲学),各种框架利弊优劣等不是本篇之目的。
首先表述一下我做这个HelloWorld的机器环境
JDK5
Eclipse 3.3.1
mysql 5.0.45-community-nt
jar包:
commons-fileupload.jar - Apache Commons Fil Upload version 1.0
commons-logging.jar - Apache Commons Logging version ???
cos-multipart.jar - Cos Multipart File Upload version ???
mail.jar - Mail API version ???
ognl.jar - OGNL version 2.6.5
oscore.jar - OSCore version 2.2.4
pell-multipart.jar - Pell Multipart File Upload version ???
velocity-dep.jar - Velocity (plus dependencies) version 1.3.1
xwork.jar - XWork version 1.0.5
打开Eclipse建一个Hello的web工程
先写一个User.java 即MVC中的M:
[color=darkred]
package com.test;
/**
*
* @author yiqiao
*/
public class User {
private String userName;
private String userPwd;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPwd() {
return userPwd;
}
public void setUserPwd(String userPwd) {
this.userPwd = userPwd;
}
}
在看一下MVC中的C:
[color=darkred]
package com.test;
import com.opensymphony.xwork.Action;
/**
*
* @author yiqiao
*/
public class LoginAction implements Action {
private User user = new User();
public String execute() throws Exception {
if (user.getUserName().equals("yiqiao"))
return this.SUCCESS;
else
return this.ERROR;
}
public User getUser() {
return user;
}
}
页面3个:
index.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>test</title>
</head>
<body>
<DIV align = "center">
LOGIN
</DIV>
<FORM action = "login.action" method = "post">
<DIV align = "center">
<TABLE border = "1" cellpadding = "0" cellspacing = "0">
<TR>
<TD>
username:
</TD>
<TD>
<INPUT type = "text" size = "10" name = "user.userName">
</TD>
</TR>
<TR>
<TD>
password:
</TD>
<TD>
<INPUT type = "text" size = "10" name = "user.userPwd">
</TD>
</TR>
<TR>
<TD colspan = "2" align = "center">
<INPUT type = "submit" value = "submit" name = "submit">
<INPUT type = "reset" value = "reset" name = "reset">
</TD>
</TR>
</TABLE>
</DIV>
</FORM>
</body>
</html>
2:ok.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix = "ww" uri = "webwork" %>
<html >
<head >
<title > OK </title>
</head>
<body>
userName= <ww:property value = "user.userName" />
<br>
userPwd= <ww:property value = "user.userPwd" />
<br>
</body>
</html>
3:error.jsp
<html >
<head>
<title> ERROR </title>
</head>
<body>
Error !!!
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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>WebWork</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<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>
</web-app>
xwork.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!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="login" class="com.test.LoginAction">
<!-- 这里的意思是登录成功后跳转到 /ok.jsp 页面 -->
<result name="success" type="dispatcher">
<param name="location">/ok.jsp</param>
</result>
<!-- 登录失败后跳转到 / error .jsp 页面 -->
<result name="error" type="dispatcher">
<param name="location">/error.jsp</param>
</result>
<!-- 此段代码为作用是将 request 请求的参数传递到 action 中 -->
<interceptor-ref name="params" />
</action>
</package>
</xwork>
- hello.rar (1.4 MB)
- 描述: eclipse 的hello web工程
- 下载次数: 118
发表评论
-
session 处理2种方式
2010-01-21 17:25 1394随着互联网的日益壮大,网站的pv和uv成线性或者指数倍的增加. ... -
异质数据结构
2009-11-21 12:28 1424堆栈、队列、链表等数据结构中的数据通常都是单一类型 ... -
Java获取代理客户端真实IP地址
2009-09-11 18:06 1911在JSP里,获取客户端的IP地址的方法是:request.ge ... -
杂论架构
2009-09-07 09:16 1045一、架构的含义 许多人对什么是架构或者架构设计包含什么内容比 ... -
nginx后面的jboss获取不到真实IP解决方案
2009-07-24 11:01 4161nginx+(1…n)tomcat集群部署时,后端tomcat ... -
byte short int long float double
2009-07-22 17:58 1503byte: 八位整数 -128——127,可用来节省内存的使用 ... -
架构思想
2009-06-26 10:15 1022一 架构思想 1.1 HTML页 ... -
jboss 4.22 优化心得
2009-01-16 13:39 1167增大可使用内存,修改bin/run.sh文件 JAVA_OPT ... -
JBoss 5.0 安装配置负载均衡
2009-01-14 17:39 5938简明JBOSS 5的安装配置说明 环境为Linux AS ... -
基于Hessian的高性能远程对象调用的服务器端和客户端的Demo 2
2008-12-31 10:52 1468<!-- Hessian服务的接口--> &l ... -
基于Hessian的高性能远程对象调用的服务器端和客户端的Demo
2008-12-31 10:48 2737概要介绍 在我们的项目中,特别是在J2EE分布式系统中,我们经 ... -
剔除List中的重复值
2008-08-28 22:34 1926方法一:循环元素删除 // 删除ArrayList中重复 ... -
spring 2.5 mvc annotation使用
2008-06-11 11:16 2709项目中一种在用spring2.0,虽然2.5出来了很多新特性, ... -
webwork2中文参考手册.pdf
2008-05-11 22:54 1834webwork2中文参考手册.pdf -
Spring-MVC-step-by-step2.rar
2008-05-11 22:51 887Spring-MVC-step-by-step2.pdf -
学习Spring
2008-05-08 11:58 12491、如何学习Spring? ... -
基于Spring技术应用的远程服务
2008-05-08 11:04 931来源:赛迪网 一.引言 从根本上分析,Remoting实 ... -
几种通讯协议的比较
2008-05-08 10:54 8182一、综述 本文比较了RMI,Hessian,Burlap,Ht ... -
JDK1.5中的线程池使用简介
2008-04-25 17:49 2793学习 JDK1.5中的线程池使用简介 ... -
jboss 启动时java.sql.SQLException: User not found: SA
2008-04-03 17:11 2484修改下面的文件: jboss-4.0.3\server\def ...
相关推荐
STRUTS2学习前 自已做的只有WEBWORK的HELLOWORLD例子 希望对你们有帮助.
webwork入门的hellworld有问题的源文件
WebWork入门例子 HelloWorld 包括相应的webwork相应的jar 希望对大家有用!!!
怎么用WebWork来实现HelloWord.docx 内容详细讲了一个初学者搭建WEBWORK实现HELLOWORLD的过程。 自己摸索的,在GOOGLE上找很多方法,可能人家都是高手写的,总是有一两个点调试不过去。 这个可以用。 适合初学者……
webwork in action_第1部分-WebWork简介_第2章-WebWork方式的Hello World
Hello World the WebWork way!
NULL 博文链接:https://goowolf.iteye.com/blog/507075
WebWork-2.1.7 中文开发文档-小白
webwork hello world example
第1章 Struts 2概述,第2章 Struts 2下的HelloWorld,第3章 Struts 2基础,第4章 深入Struts 2,第5章 Struts 2的类型转换,第6章 文件的上传和下载.,第7章 Struts 2的拦截器,第8章 Struts 2的输入校验,9.2 ...
一个word文档,按照我的文章把helloworld执行成功后再看这个好一些,因为当初我用它做helloworld的时候没有成功。
struts2概述 strust2下的HelloWorld struts2基础 深入struts2 struts2类型转换 文件的上传和下载 ... 这本书太大了,我把它分为了12部分上传,给大家造成的不便,还请谅解
struts2概述 strust2下的HelloWorld struts2基础 深入struts2 struts2类型转换 文件的上传和下载 ... 这本书太大了,我把它分为了12部分上传,给大家造成的不便,还请谅解
struts2概述 strust2下的HelloWorld struts2基础 深入struts2 struts2类型转换 文件的上传和下载 ... 这本书太大了,我把它分为了12部分上传,给大家造成的不便,还请谅解
struts2概述 strust2下的HelloWorld struts2基础 深入struts2 struts2类型转换 文件的上传和下载 ... 这本书太大了,我把它分为了12部分上传,给大家造成的不便,还请谅解
struts2概述 strust2下的HelloWorld struts2基础 深入struts2 struts2类型转换 文件的上传和下载 ... 这本书太大了,我把它分为了12部分上传,给大家造成的不便,还请谅解
struts2概述 strust2下的HelloWorld struts2基础 深入struts2 struts2类型转换 文件的上传和下载 ... 这本书太大了,我把它分为了12部分上传,给大家造成的不便,还请谅解