首页 技术 正文
技术 2022年11月20日
0 收藏 961 点赞 2,627 浏览 1292 个字

说明:本系列是针对struct2学习过程,主要的目的:

1. 探索针对一个新的开源框架的学习过程。

2. 学习struct2,学习官方对struct2介绍的方法。

3.别把英语忘了。

1. 为了更加清晰的明白struct工程每个文件的意义,我们新建的是一个普通的java工程。

这个工程使用jetty直接调试,这样比较的方便,具体的见:jetty直接调试

需要注意的是:

WebAppContext webapp = new WebAppContext(“WebRootFile”, “/struct2”);

文件名和工程名,与在建立工程的文件名和工程名称一样,就好。

测试工程:

ok了,准备工作完成。

添加struct2的支持,这个都比较的简单,直接贴张图吧。

下面的步骤,struct2的官方教程:

web.xml为:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name></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>*.action</url-pattern>
</filter-mapping>
</web-app>

structs.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>
<constant name="struts.devMode" value="true" /> <package name="basicstruts2" extends="struts-default"> <action name="index">
<result>/index.jsp</result>
</action> </package>
</struts>

ok,第一个struct完成。但是没有什么展示的效果比较的不能说明问题,下一步我们加一点展示的内容。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,076
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,552
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,400
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,812
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,894