这里进行struts框架的配置问题,和简单的输出hellow world

配置的步骤

1.      配置TomCat

2.      JDK

3.      拷贝struts.xml文件到src目录

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd"> <struts>
<!--
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" /> <include file="example.xml"/> <package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index" />
<action name="index">
<result type="redirectAction">
<param name="actionName">HelloWorld</param>
<param name="namespace">/example</param>
</result>
</action>
</package>
--> <constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default"> <action name="hello">
<result>
/Hello.jsp
</result>
</action>
</package>
<!-- Add packages here --> </struts>

4.      拷贝jar文件包到lib目录下

随便去网上下一个struts2 的包,然后解压就能够得到想要的文件

可以到这个地址去下载http://struts.apache.org/download.cgi

5.      配置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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Struts</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> <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>

这里是将filter 的内容引入到web.xml里面就行了

在根目录创建一个Hello.jsp文件,里面写一段测试的"hello world"

最后在浏览器的地址栏中输入http://localhost:8080/Struts/hello

就能够打出相应的  "hello world"

到这里就说明struts2的配置已经完成了

源码:http://pan.baidu.com/s/1boVgrgV

Java-struts2 配置hellow world的更多相关文章

  1. Java Struts2 POI创建Excel文件并实现文件下载

    Java Struts2 POI创建Excel文件并实现文件下载2013-09-04 18:53 6059人阅读 评论(1) 收藏 举报 分类: Java EE(49) Struts(6) 版权声明: ...

  2. 小兵眼中的Java Struts2

        老魏终于可以回园子了,但是这次要慢慢的回来,不能一下子回来,这段时间除了要照顾刚出生的小女儿,还要做项目.说实在的老魏时间真是有限,不能照顾到园子的文章了,所以只能慢慢的回来写文章了.抱歉! ...

  3. MyEclipse下Struts2配置使用和Ajax、JSON的配合

    原创文章,转载请注明:MyEclipse下Struts2配置使用和Ajax.JSON的配合  By Lucio.Yang 新手,初学Struts2的配置,同时尝试与Ajax通过JSON交互.首先介绍M ...

  4. java struts2入门学习实例--将客户端IP地址和访问方式输出到浏览器

    实例1:实现客户端IP地址和访问方式输出到浏览器. IpAction.java package com.amos.web.action; import javax.servlet.http.HttpS ...

  5. web09 struts2配置 struts2入门

    电影网站:www.aikan66.com 项目网站:www.aikan66.com游戏网站:www.aikan66.com图片网站:www.aikan66.com书籍网站:www.aikan66.co ...

  6. web 08 struts2入门 struts2配置 struts包

    电影网站:www.aikan66.com 项目网站:www.aikan66.com游戏网站:www.aikan66.com图片网站:www.aikan66.com书籍网站:www.aikan66.co ...

  7. 【SSH2(理论篇)】--Struts2配置具体解释

    上篇博客讨论了SSH2框架模型,在开发过程中发现SSH2的开发模型事实上类似于经典的三层模式,在每一层中分别加入了不同的框架,显示层使用的是Struts2进行配置的,业务逻辑层使用的是Spring配置 ...

  8. java环境配置笔记

    1.使用Eclipse,要安装jdk,jdk现在可用1.7版本 2.打开Eclipse,配置maven,打开window-preferencess,在maven-user settings处,设置ma ...

  9. [SSH 2] 以网站主页面浅谈Struts2配置

    导读:前面总体的介绍了一下SSH框架,那么作为Struts这一支,具体是怎么配置的呢?本篇博客则主要是以自己做过的实例中的登录一条线,简单介绍一下struts2的配置,如有不妥之处,还请大家多提点提点 ...

  10. Java环境配置原理

    Java环境配置原理详解 1.Jdk安装目录文件说明: 一般jdk安装目录及路径 \Java\jdk1.7.0_79\lib,里面主要包含以下文件夹. bin:主要存放的是java工具中常用命令如:j ...

随机推荐

  1. insert into select * from 锁表

    mysql[192.168.11.187] processid[249] root@localhost in db[zjzc] hold transaction time 197 112069858, ...

  2. Specify a culture in string conversion explicitly

    Specify a culture in string conversion explicitly There are different methods of grouping symbols, l ...

  3. bzoj1758

    好题显然是分数规划,二分答案之后我们要找是否存在一条边数在[l,u]长度和为正的路径可以用树的分治来解决这个问题我们假设当前处理的是过点root的路径显然我们不好像之前男人八题里先算出所有答案,然后再 ...

  4. 在Apache上部署Django

    跟php类似,要想使Apache能够处理python脚本(实际上Apache是不能处理脚本的,只是利用别的扩展模块处理相应脚本),就要给Apache安装相应的扩展模块. Apache起初的python ...

  5. KEIL、uVision、RealView、MDK、KEIL C51区别比较

    KEIL uVision,KEIL MDK,KEIL For ARM,RealView MDK,KEIL C51,KEIL C166,KEIL C251 从接触MCS-51单片机开始,我们就知道有一个 ...

  6. JavaScript高级程序设计50.pdf

    hashchange事件 HTML5新增了hashchange事件,以便在URL的参数列表(及URL中“#”号后面的所有字符串)发生变化时通知开发人员,之所以新增这个事件,是因为在Ajax应用中,开发 ...

  7. [转]Angular, Backbone, or Ember: Which is Best for your Build?

    In order to choose which framework is right for your build, we've asked four important questions of ...

  8. NIR相机

    近红外(NIR)相机——专为低照度环境而设计的高灵敏度相机 近红外光”(Near-Infrared) 是介于可见光和中红外光间的电磁波,因此是不能被人眼所察觉到的.近红外优化工业相机广泛适用于交通监控 ...

  9. (DT系列二)device tree的书写规范

    devicetree的书写规范 下面从节点,属性,reg,ranges,中断控制器等几个方面叙述devicetree的书写规范. 1,dts的基本元素:节点 .dts(或者其include的.dtsi ...

  10. Y2K Accounting Bug

    题目: Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost som ...