自己动手搭环境—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,另一种 ...
随机推荐
- 2019-9-2-C#同步方法转异步
title author date CreateTime categories C#同步方法转异步 lindexi 2019-09-02 12:57:37 +0800 2018-2-13 17:23: ...
- linux seqlock 锁
内核包含了一对新机制打算来提供快速地, 无锁地存取一个共享资源. seqlock 在这 种情况下工作, 要保护的资源小, 简单, 并且常常被存取, 并且很少写存取但是必须要快. 基本上, 它们通过允许 ...
- AI百度接口以及图灵接口的使用
百度AI接口 AI智能种类方向 耳朵 = 倾听 = 麦克风 = 语音识别 ASR:Automatic Speech Recognition 嘴巴 = 诉说 = 扬声器 = 语音合成 TTS:Text ...
- Fast Stone截图工具使用教程
下面是Fast Stone的显示面板,很小巧,但功能强大 一.特殊功能 1.1 添加水印 (1)选择功能栏的"Edge" (2)将要水印的图片选中,选择水印图片的放置位置,应用即可 ...
- 性能测试基础-开门篇3(LR常用函数介绍)
LR常用的函数,协议不一样函数会不一样,这里简单的介绍下HTTP\WEBSERVICE\SOCKET协议常用函数: HTTP: web_set_max_html_param_len("102 ...
- (转)学习C语言基本思路与参考书籍
计算机行业发展非常快,大学里的教育基本都跟不上实际的社会需求.如果你所在的学校还在指定大家使用谭浩强的教材,或使用VC6.0来教大家上机实验,那你不妨看看本文,这里有一些建议可以帮助你不会脱离社会太远 ...
- 【11.61%】【codeforces 670F】Restore a Number
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- C#面试题整理(不带答案)
1.维护数据库的完整性.一致性.你喜欢用触发器还是自写业务逻辑?为什么? 2.什么是事务?什么是锁? 3.什么是索引,有什么优点? 4.视图是什么?游标是什么? 5.什么是存储过程?有什么优 ...
- Flask学习-Virtualenv
http://www.pythondoc.com/ VirtualEnv Virtualenv用于同一台机器上创建多个独立的Python虚拟运行环境,多个Python环境相互独立,互不影响,它能够: ...
- stm32外部时钟源8M换成12M后库函数相应修改总结
前言 在做“自制继电器上位机控制软件”项目的时候,下位机用到USB虚拟串口,将以前写好的USB虚拟串口程序移植到下位机,发现程序计算机无法识别到虚拟串口STMicroelectronics Virtu ...