struts2_20140720
有这样的感觉:前面学的东西弄会了,过了一段时间又感觉陌生了,还要重新开始。这次想个好办法,把写的程序用博客记录下来,把自己的学历历程用博客的形式呈现出来,一来可以方便复习,而来可以以后开发程序可以快速上手,而且代码有快速参考价值。
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的更多相关文章
随机推荐
- Spring boot 提高篇
Spring boot 提高篇 上篇文章介绍了Spring boot初级教程:构建微服务:Spring boot 入门篇,方便大家快速入门.了解实践Spring boot特性:本篇文章接着上篇内容继续 ...
- Linux APP源码级编译安装
首先需要了解下tar包. 以下文章作出解释了: http://www.cnblogs.com/laipDIDI/articles/2214270.html http://baike.baidu.com ...
- ant的入门 配置与安装
最近需要用ant来生成文件,java类.我才开始了解了这个工具.仔细看了一下,感觉这个小工具的强大功能. 博主也是初学者,在网上收集了资料,尝试了配置:感觉有些高手写得不错变引用之. 配置如下: 以上 ...
- JavaEE Tutorials (30) - Duke综合案例研究示例
30.1Duke综合应用的设计和架构456 30.1.1events工程458 30.1.2entities工程459 30.1.3dukes—payment工程461 30.1.4dukes—res ...
- python选择排序实现与C选择排序实现
python代码: #coding=utf-8 if __name__=="__main__": arr=[3,2,1,7,11,4,5,8] print "Before ...
- poj 3370 Halloween treats(鸽巢原理)
Description Every year there is the same problem at Halloween: Each neighbour is only willing to giv ...
- 移除UIView上面的所有控件
;i<[view.subviews count];i++){ [ [ view.subviews objectAtindex:i] removeFromsuperview]; }
- Memcached安装,操作,用C#操作
本文来自:http://li19910722.blog.163.com/blog/static/136856822201406103313163/ 1:安装 下载Memcache:http://cod ...
- 标准linuxserver搭建
一:针对大数据平台的linux例如以下搭建.为了方便截图,採用的虚拟机,与真实环境有点出入 二:过程例如以下 1. 在vmware中选择载入虚拟光盘iso文件,然后进入安装 2. 默认选择第一项 In ...
- C# ?? 操作符示例
static int? GetNullableInt() { return null; } static string GetStringValue() { return null; } static ...