自己动手搭环境—unit 1、Struts2环境搭建
1、web.xml中增加Struts2配置
<filter>
<filter-name>struts2</filter-name>
<filter-class>
<!--org.apache.struts2.dispatcher.FilterDispatcher不推荐使用-->
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2、在WEB-INF/lib中加入jar
struts2-core-2.x.x.jar、xwork-core-2.x.x.jar、log4j-1.x.x.jar、commons-fileupload-1.x.x.jar、commons-lang-2.x.jar、commons-logging-1.x.x.jar、freemarker-2.x.x.jar、javassist-3.x.GA.jar
3、配置struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<constant name="struts.devMode" value="true"/>
<constant name="struts.action.extension" value="do,action"/>
<constant name="struts.locale" value="zh_CN" /> <package name="struts" extends="struts-default">
<action name="hello" class="com.example.demo.action.HelloAction">
<result name="success">/hello.jsp</result>
</action>
</package> </struts>
4、编写action
package com.example.demo.action; import com.opensymphony.xwork2.ActionSupport; public class HelloAction extends ActionSupport{ private static final long serialVersionUID = -4395197537614656411L;
private String message; public String execute() {
message = "xiao hei!";
return SUCCESS;
} public String getMessage() {
return message;
} public void setMessage(String message) {
this.message = message;
} }
5、编写resultpath-hello.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>welcome</title>
</head>
<body>
Hello world, ${message}
</body>
</html>
6、启动tomcat,浏览器输入http://localhost/strutsdemo/hello.do
Hello world, xiao hei!
附项目:http://pan.baidu.com/share/link?shareid=3806371118&uk=1426082551
自己动手搭环境—unit 1、Struts2环境搭建的更多相关文章
- 最新版ssh hibernate spring struts2环境搭建
最新版ssh hibernate spring struts2环境搭建 最新版spring Framework下载地址:spring4.0.0RELEASE环境搭建 http://repo.sprin ...
- struts2环境配置
struts2环境配置 struts2框架,大多数框架都在使用.由于工作需要,开始做Java项目.先学个struts2. 一.下载struts2 有好多版本,我下载的是struts-2.2.1.1. ...
- Myeclipse搭建struts2环境
1.下载Struts2 到Apache Struts2官网下载最新的Struts2 http://struts.apache.org/download.cgi#struts2316-SNAPSHOT ...
- 第3章 Struts2框架--1、Struts2环境搭建
第3章 Struts2框架--1.Struts2环境搭建 搭建步骤: 1.从下载http://struts.apache.org 没找到Struts2.3.16版,就下载了2.3.29 2.拷贝后解压 ...
- Eclipse搭建struts2环境
搭建struts2环境 大的方面分为三步: 1. 加入jar包 2. 在web.xml中配置struts2 3. 添加struts2的配置文件struts.xml 下面是详细步骤: 1. 新建一个Dy ...
- (原创)超详细一步一步在eclipse中配置Struts2环境,无基础也能看懂
(原创)超详细一步一步在eclipse中配置Struts2环境,无基础也能看懂 1. 在官网https://struts.apache.org下载Struts2,建议下载2.3系列版本.从图中可以看出 ...
- Jenkins+GitHub+Xcode+fir搭了一个持续集成环境
enkins+GitHub+Xcode+fir搭了一个持续集成环境 字数826 阅读5699 评论44 喜欢49 原文链接 Coding Duck 今天用Jenkins+GitHub+Xcode+fi ...
- struts2 环境建立(1)
说明:以下操作都是以本机例 在java web 开发之前,应该具备开发环境.要搭建开发环境应该具备以下工作: 1 JDK,jdk是java开发不可缺少的开发工具包. 2. 开发工具本例使用Eclips ...
- 突破瓶颈,对比学习:Eclipse开发环境与VS开发环境的调试对比
曾经看了不少Java和Android的相关知识,不过光看不练易失忆,所以,还是写点文字,除了加强下记忆,也证明我曾经学过~~~ 突破瓶颈,对比学习: 学习一门语言,开发环境很重,对于VS的方形线条开发 ...
- Tomcat与Jre绿色环境配置(生产环境)
Tomcat与Jre绿色环境配置(生产环境) 博客分类: Apache Java jreapachetomcat Tomcat运行时需要jre的支持,一般有两种方式,一种是用jdk带的jre,另一种 ...
随机推荐
- 第一种方式:cookie的优化与购物车实例
一 Cookie 的优化 1.1 一般而言,我们设置cookie是在php中设置 例如: <?php setcookie('testKey1','hello world',0,'/'); //# ...
- Codeforces Beta Round #4 (Div. 2 Only) D. Mysterious Present(LIS)
传送门 题意: 现在我们有 n 个信封,然后我们有一张卡片,并且我们知道这张卡片的长和宽. 现给出这 n 个信封的长和宽,我们想形成一个链,这条链的长度就是这条链中所含有的信封的数量: 但是需要满足① ...
- 2019-4-6-VisualStudio-2019-如何离线下载
title author date CreateTime categories VisualStudio 2019 如何离线下载 lindexi 2019-04-06 09:26:11 +0800 2 ...
- Redis内存回收机制
为什么需要内存回收? 原因有如下两点: 在 Redis 中,Set 指令可以指定 Key 的过期时间,当过期时间到达以后,Key 就失效了. Redis 是基于内存操作的,所有的数据都是保存在内存中, ...
- 找不到 javax.servlet.http.HttpServletResponse 和 javax.servlet.http.HttpServletRequest 问题解决
时隔3个月,我又回来了!在做完毕设之后,由于对此过程中学到的一些东西疏于整理,所以当再次打开我的project时有些手足无措,以至于出现一些问题也要解决好半天,我知错! 今天的问题是: 开始搜到的解决 ...
- UVA live 6667 三维严格LIS
UVA live 6667 三维严格LIS 传送门:https://vjudge.net/problem/UVALive-6667 题意: 每个球都有三个属性值x,y,z,要求最长的严格lis的长度和 ...
- mysql中的表操作
------------恢复内容开始------------ 创建数据库 create database 数据库名 切换数据库 use 数据库名 建表: create table 表名 ( 字段名1, ...
- 玩转MQTT-阿里云之MQTT使用(下)
玩转MQTT-阿里云之MQTT使用(下) 摘要 为使物联网项目在正式使用时,能顺利切换到具有高并发高负载能力的服务平台,对阿里云提供的MQTT服务进行使用验证. 引言 之前写“MQTT之阿里云使用-玩 ...
- 最小化centos7.4系统静默安装oracle12.2
一 orace简介 ORACLE(甲骨文)公司.Oracle Database (甲骨文数据库) 是一个具有对象和可扩展标记语言(XML)功能的关系数据库,提供的以分布式数据库为核心的一组软件产品,是 ...
- 【题解】Uoj#30 Tourist(广义圆方树+树上全家桶)
[题解]Uoj#30 Tourist(广义圆方树+树上全家桶) 名字听起来很霸气其实算法很简单.... 仙人掌上的普通圆方树是普及题,但是广义圆方树虽然很直观但是有很多地方值得深思 说一下算法的流程: ...