Structs2下的MyFirstTest
1.这是《Struts2-权威指南》第二章的例子
2.博文主要说明在eclipse下如何创建一个struts2项目
<web-app 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" version="3.0">
<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>

<!-- 指定Struts 2配置文件的DTD信息 -->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<!-- struts是Struts 2配置文件的根元素 -->
<struts>
<!-- Struts 2的Action必须放在指定的包空间下定义 -->
</struts>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title><s:text name="登录页面"/></title>
</head>
<body>
<s:form action="Login">
<s:textfield name="username" label="用户名" />
<s:textfield name="password" label="密码" />
<s:submit value="登录"/>
</s:form>
</body>
</html>
<html>
<head>
<title>成功页面</title>
</head>
<body>
${sessionScope.user},登陆成功!
</body>
</html>
<html>
<head>
<title>失败页面</title>
</head>
<body>
登陆失败!
</body>
</html>
<!-- 指定Struts 2配置文件的DTD信息 -->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<!-- struts是Struts 2配置文件的根元素 -->
<struts>
<!-- Struts 2的Action必须放在指定的包空间下定义 -->
<package name="myFirstTest" extends="struts-default">
<action name="Login" class="lee.LoginAction">
<result name="success">/welcome.jsp</result>
<result name="error">/error.jsp</result>
</action>
</package>
</struts>
Structs2下的MyFirstTest的更多相关文章
- 初学structs2,简单配置
一.structs2-demo1项目下新建structs.xml文件,文件名必须是structs 二.package节点配置及其子节点配置 <!--name:单纯给包起个名字,保证和其他包不重名 ...
- C++程序结构---1
C++ 基础教程Beta 版 原作:Juan Soulié 翻译:Jing Xu (aqua) 英文原版 本教程根据Juan Soulie的英文版C++教程翻译并改编. 本版为最新校对版,尚未定稿.如 ...
- 初学structs2,表单验证
一.简单表单验证示例 structs.xml配置 <struts> <package name="validate" namespace="/valid ...
- 搭建 structs2 环境
前言 环境: window 10 ,JDK 1.8 ,Tomcat 7 ,MyEclipse 2014 pro 搭建 SSH 环境的步骤 创建 JavaWeb 项目 导入 structs2 的jar包 ...
- 十四、MVC的WEB框架(Structs2)
一.Structs2中的Session 1.一个是传统的servlet包下的HttpSession,一个是Structs2中自己定义的Session Servlet下的Session获取方法:Serv ...
- 十三、MVC的WEB框架(Structs2)
一.Structs2的应用 Structs2是基于MVC的WEB框架.一般基于框架的程序要运行成功,对于JAR包的版本,配置文件的正确性有着苛刻的要求,一个地方错了,都会导致框架程序运行出错. 1.首 ...
- Structs2笔记③--局部类型转换案例
Structs2的类型转换-局部类型转换 Ognl强大的表达式语言,在导入项目的时候我们导入了ognl.jar包,内有TypeConverter类,struct主要依赖于他进行类型转换. 例子 i ...
- Code First 下自动更新数据库结构(Automatic Migrations)
示例 Web.config <?xml version="1.0" encoding="utf-8"?> <configuration> ...
- Android SwipeRefreshLayout 下拉刷新——Hi_博客 Android App 开发笔记
以前写下拉刷新 感觉好费劲,要判断ListView是否滚到顶部,还要加载头布局,还要控制 头布局的状态,等等一大堆.感觉麻烦死了.今天学习了SwipeRefreshLayout 的用法,来分享一下,有 ...
随机推荐
- JavaScript动态创建script标签并执行js代码
<script> //创建一个script标签 function loadScriptString(code) { var script = document.createElement( ...
- web项目重启命令
jps -lvm|grep "young_rd_10004" | awk '{print $1}'|xargs kill -9; sleep 3; /home/web_server ...
- 也谈HTTP协议
HTTP(HyperText Transfer Protocol,超文转移协议,超文本传输协议的译法并不严谨.) 一.网络基础 TCP/IP 1.1 TCP/IP 协议族 TCP/IP 协议族是互联网 ...
- php 配置优化
调整php内存限制 vim /usr/local/php/php.ini memory_limit = 1024M 内存优化 /usr/local/php/etc/php-fpm.conf https ...
- clr/c++自定线程安全集合
代码如下: 难点重写索引器.重写基类方法.基类方法显示调用示例 generic <class T> public ref class SyncList : public List<T ...
- 编译rxtx
https://blog.csdn.net/github_29989383/article/details/51886234 https://cloud.tencent.com/developer/a ...
- 屏蔽ffmpeg命令的所有提示
有时候需要隐蔽的执行ffmpeg不希望输出任何日志,提示.这个时候只需要多添加这个参数即可 -loglevel quiet
- mysql命令使用2
mysql查询默认不区分大小写,如果需要区分大小写,使用binary mysql>select * from teacher where binary name='niu'; mysql查询默认 ...
- lnmp源码搭建
Nginx工作原理 这里需要结合Apache的工作,对PHP文件处理过程的区别 1:Nginx是通过php-fpm这个服务来处理php文件 2:Apache是通过libphp5.so ...
- 使用resultMap定义查询结果集,实现关联查询
接下来介绍resultMap定义查询结果集,实现关联查询 1 首先在接口中定义操作的方法 public interface EmployeeMapperPlus { public Employee g ...