有这样的感觉:前面学的东西弄会了,过了一段时间又感觉陌生了,还要重新开始。这次想个好办法,把写的程序用博客记录下来,把自己的学历历程用博客的形式呈现出来,一来可以方便复习,而来可以以后开发程序可以快速上手,而且代码有快速参考价值。

struts 2第一节:

第一步:新建web project,默认index.jsp.

第二步:在src目录下,新建(或者从struts包中拷贝)struts.xml文件。导入类库。struts.xml代码:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts> <package name="myPackage" extends="struts-default">
<action name="first">
<result>
/first.jsp
</result>
</action>
</package> </struts>

第三步:web.xml文件更改:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>struts2_20140720</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

第二步和第三步在myeclipse中可以自动完成。选定工程名称-->右键--->myeclipse--->project-facets--->install apache struts 2

第三步:index.jsp中添加链接标签

<a href="first.action">struts.2</a>

第四步:新建first.jsp

部署,ok!

struts2_20140720的更多相关文章

随机推荐

  1. asp.net mvc4 signalR后台自推送

    1.在引用中添加signalr后首选要引入Startup.cs类,在VS2012中添加Signalr后没有Startup.cs类然后就会报错 代码如下 using System; using Syst ...

  2. 串口WIF简单调试

    /*********************************************************************** Title:Wifi串口调试 Hardware: Wi ...

  3. 《how to design programs》第10章表的进一步处理

    返回表的函数: 下面是一个求工资的函数: ;; wage : number  ->  number ;; to compute the total wage (at $12 per hour) ...

  4. Ajax 缓存问题

    Ajax通过GET方式请求服务器数据,Microsoft Internet Explorer浏览器下,由于缓存问题,读取的数据非最新数据,解决问题方法如下: function getData(url, ...

  5. tomcat配置访问日志,访问首页主目录

    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" ...

  6. python开发初期及二次开发C api

    1,python2 or python 区别, https://wiki.python.org/moin/Python2orPython3 python software foundation 2,p ...

  7. apache FtpServer 整合spring部署

    我们在项目中可能会出现这样的需求,使用ftp上传很大的文件后对需要对文件进行相应的逻辑处理,这时我们可以使用apache ftpServer来处理这段逻辑,只要我们做相应的部署和编写我们的逻辑代码,这 ...

  8. android 分享到新浪微博

    分享到新浪微博,折腾了大半个月,现在终于弄出来了,心里的那个爽呀,太痛快了,哈哈!! 废话少说,首先是认证, 1.进入新浪微博提供的开放平台注册新浪账号. 2.点击’我是开发者‘,创建一个应用,得到C ...

  9. distinct() 去重复

    distinct 是对整个结果集进行数据重复抑制,而不是针对每一个列. select distinct FDepartment from T_Employee

  10. poj 3301 Texas Trip(几何+三分)

    Description After a day trip with his friend Dick, Harry noticed a strange pattern of tiny holes in ...