struts2 基本用法
Struts2必需库: commons-fileupload.jar、commons-io-1.3.2.jar、freemarker-2.3.16.jar、javassist-3.7.ga.jar、ognl-3.0.jar、
struts-core-2.2.1.jar和xwork-core-2.2.1.jar
============================================================
struts.xml
<?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.devMode" value="false" />
<constant name="struts.ui.theme" value="simple"/>
<constant name="struts.i18n.encoding" value="UTF-8" />
<!-- <constant name="struts.custom.i18n.resources"
value="resources/framework/messages/messages-common,
resources/framework/messages/messages-welcome,
resources/framework/messages/messages-exception,
resources/framework/messages/messages-admin,
resources/framework/messages/messages-dictionary,
resources/framework/messages/messages-cnapsmanage,
resources/framework/messages/messages-clearing"/> -->
<!-- 上传文件大小限制 ,最大不超过100M-->
<constant name="struts.multipart.maxSize" value="104857600"/>
<!--<constant name="struts.multipart.saveDir" value="/opt/apache-tomcat-6.0.43/temp"/>--> <constant name="struts.action.extension" value="do" /> <package name="BasePackage" extends="json-default" namespace="/system">
<interceptors>
<!-- <interceptor name="AppExceptionHandler" class="com.agree.framework.struts2.interceptors.ExceptionHandlerInterceptor"></interceptor>
<interceptor name="ActionLogger" class="com.agree.framework.struts2.interceptors.ActionLoggingInterceptor"></interceptor> -->
<interceptor name="PrivilegeJudger" class="com.agree.framework.struts2.interceptors.PrivilegeJudgeInterceptor"></interceptor>
<interceptor name="DownloadPrivilege" class="com.agree.framework.struts2.interceptors.DownloadPrivilegeInterceptor"/> <!-- <interceptor-stack name="SystemConsoleInterceptorStack">
<interceptor-ref name="PrivilegeJudger"></interceptor-ref>
<interceptor-ref name="ActionLogger"></interceptor-ref>
<interceptor-ref name="AppExceptionHandler"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack> -->
</interceptors> <global-results>
<!-- <result name="login">/webpages/freamwork/welcome/welcomeTimeOut.jsp</result>
<result name="nologin">/webpages/freamwork/welcome/nologin.jsp</result>
<result name="APPEXCEPTION">/webpages/freamwork/exception/exception.jsp</result>
<result name="AJAX_SUCCESS" type="json">
<param name="ignoreHierarchy">false</param>
<param name="includeProperties">actionresult</param>
</result> -->
<result name="noSecurity">/noSecurity.jsp</result>
</global-results> <!-- 系统登录 -->
<action name="logon_*" class="LogonActionBean" method="{1}">
<!-- <interceptor-ref name="SystemConsoleInterceptorStack"></interceptor-ref> -->
<result name="success" type="json"></result>
<result name="redirect">/Pages/Layout/index.jsp</result>
<result name="logout">/Pages/Layout/login.jsp</result>
<result name="tologin">/Pages/Layout/login.jsp</result>
</action> </package> <include file="resources/framework/struts2//struts-layout.xml"></include>
<include file="resources/framework/struts2//struts-access.xml"></include>
<include file="resources/framework/struts2//struts-example.xml"></include>
<include file="resources/framework/struts2//struts-config.xml"></include>
<include file="resources/framework/struts2//struts-ide.xml"></include> </struts>
struts2 基本用法的更多相关文章
- Struts2 extends用法
1.创建一个struts-extends.xml文件 <?xml version="1.0" encoding="UTF-8"?> <!DOC ...
- 【SSH2(实用文章)】--Struts2文件上传和下载的例子
回想一下,再上一篇文章Struts2实现机制,该步骤做一步一步来解决,这种决心不仅要理清再次Struts2用法.映射机制及其在深入分析.最后一个例子来介绍Struts2一种用法,这里将做一个有关文件上 ...
- struts2整合spring应用实例
我们知道struts1与spring整合是靠org.springframework.web.struts.DelegatingActionProxy来实现的,以下通过具体一个用户登录实现来说明stru ...
- Struts笔记一
Struts 概念: 是一个MVC框架: Servlet的缺点 1.在web.xml中文件中需要配置很多行代码,维护起来很不方便呢,不利于团队合作. 2.一个servlet的入口只有一个doPost或 ...
- Struts 2的流程
Struts 2的流程 一.Struts 2 的开发步骤: 在web.xml中定义核心的Filter来拦截用户的请求. 由于Web应用时基于请求/响应架构的应用,所以不管哪个MVC Web框架,都需要 ...
- struts2中#,$,%的用法以及el,ognl表达式的用法
OGNL, JSTL, STRUTS2标签中符号#,$,%的用法示例 取Session中的值 <c:out value="${sessionScope.user.userId}&quo ...
- J2EE进阶(三)struts2 <s:action>标签的用法
J2EE进阶(三)struts2 <s:action>标签的用法 前言 使用action标签,可以允许在jsp页面中直接调用Action,(类似AJAX页面调用)在调用Action时候,可 ...
- java struts2入门学习--OGNL语言基本用法
一.知识点学习 1.struts2中包含以下6种对象,requestMap,sessionMap,applicationMap,paramtersMap,attr,valueStack; 1)requ ...
- struts2中s:iterator 标签的使用详解 及 OGNL用法
简单的demo: s:iterator 标签有3个属性:value:被迭代的集合id :指定集合里面的元素的idstatus 迭代元素的索引 1:jsp页面定义元素写法 数组或list <s ...
随机推荐
- .NET中Debug模式与Release模式
Visual Studio 项目对程序的发布和调试版本分别有单独的配置.顾名思义,生成调试版本的目的是用于调试,而生成发布版本的目的是用于版本的最终分发. 如果在 Visual Studio 中创建程 ...
- win7局域网里输入正确密码也访问不了其他的机器
1.本地安全策略-本地策略-安全选项-网络安全:LAN管理器身份验证级别,默认是“没有定义”,更改为“发送LM和NTLM响应! Windows 7系统自带的是一个统安全管理工具--本地安全策略,它可以 ...
- Visual Studio中设置默认VC++路径
菜单"View" -> "Other Windows" -> "Property Manager" 选择对应的配置并修改即可.
- NYOJ:题目524 A-B Problem
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=860 My思路: 先用两个字符串储存这两个实数,然后再用另外两个字符串储存去掉符号和前后多 ...
- spring aop advice
1.前置通知(BeforeAdvice): import java.lang.reflect.Method; import org.springframework.aop.MethodBeforeAd ...
- Python for循环内部实现的一个sample
#!/usr/bin/env python # -*- coding: utf-8 -*- it = iter([1,2,3,4,5]) while True: try: x = next(it) p ...
- Windows 2012 R2中安装SharePoint 2013 sp1参考
之前介绍过在window 2012中安装SharePoint 2013,这次,借着SharePoint 2013 sp1补丁发布之际,介绍下在window 2012 r2中安装SharePoint 2 ...
- Web安全开发注意事项
1.sql注入:这个很常规了,不要拼字符串以及过滤关键字都可以防住,需要注意的是,Cookie提交的参 数也是可以导致注入漏洞的.2.旁注:就是说在保证自己的程序没问题的同时,也要保证同台服务器的其他 ...
- Struts2(十二)使用验证框架验证数据较验
一.数据验证 1.1.为什么要进行数据验证 对数据的合法性进行检查,只允许合法的数据进入应用程序 1.2.在哪里实现数据验证 客户端验证: 数据提交前在客户端验证 可使用JavaScript或者JQu ...
- 【转】IOS动画的实现,其实很简单
动画效果提供了状态或页面转换时流畅的用户体验,在iOS系统中,咱们不需要自己编写绘制动画的代码,Core Animation提供了丰富的api来实现你需要的动画效果.UIKit只用UIView来展示动 ...