zw7534313的博客 -凯发k8国际

`
文章列表
  struts2 对异常的处理 使用自定义类处理异常1.定义异常类2.定义拦截器类,并加入默认拦截器栈3.struts.xml 配置4.注意,struts-default.xml 有默认的异常处理拦截器:name="exception", 默认拦截器栈:defaultstack
  struts/spring/mybatis的整合 1.struts配置:struts-*.xml
  在jsp页面与action之间的桥梁对于程序员来说就是set get方法以及valuestack,既然对方始终获取不了值,那么要么是valuestack有问题(这个框架的东东应该不会错),那就是set get 方法的问题。最后找到使用自动生成set get方法的权� ...
  struts2中action接收参数的方法主要有以下三种:   1.使用action的属性接收参数:    a.定义:在action类中定义属性,创建get和set方法;    b.接收:通过属性接收参数,如:username;    c.发送:使用属性名传递参数,如:user1!add?username=magci;2.使用domainmodel接收参数:    a.定义:定义model类,在action中定义model类的对象(不需要new),创建该对象的get和set方法;    b.接收:通过对象的属性接收参数,如:user.getusername();    c.发送:使用 ...
       struts2.3.24、spring4.1.6、mybatis3.3集成框架:        1.log4j      2.junit      3.quartz      4.ehcache      5.spring ioc      6.spring aop @aspect 面向切面编程        首先,mybatis与spring集成,配置datasource,配置sqlsessionfactory      然后,struts2与spring集成,配置struts.xml:     
struts2 中ognl表达式的用法: ognl(object-graph navigation language),可以方便地操作对象属性的开源表达式语言; “#”主要有三种用途:       1. 访问ognl上下文和action上下文,#相当于actioncontext.getcontext();下表有几个actioncontext� ...
“%”符号的用途是在标志的属性为字符串类型时,计算ognl表达式的值。例如在ognl.jsp中加入以下代码:
   

%的用途

   

   

清单6 演示%用途的代码片段 刷新页面,结果如下所示:  
http://www.ilovejs.net/archives/category/javascript   js优化         js_function.html    
struts2集成spring: spring插件通过覆盖struts2的objectfactory来工作,经过这个配置后,struts2框架将使用spring来创建它的所有对象。如果对象不能被spring创建,那么框架将创建对象自身。 interceptors 元素内部定义的两个拦截器作为一种替代选择,在你没有使用spring的objectfactory时,用于自动装配action,你需要在struts.xml文件中显式地去引用这两个拦截器。
struts2提供了两种方式来访问request,session,application 第一种方式:与servlet api解耦的访问方式 (1)struts2对httpservletrequest,httpsession,servletcontext进行了封装,构造了三个map对象来替代这三种对象,在action中,直接使用对应的map对象来保存和读取数据。 actioncontext是action执行的上下文,在actioncontext中保存了action执行所需的一组对象:paramet
struts2通用标签:   数据标签: 1.  property 用于输出值栈中的对象的属性值   2.set 将一个值赋给指定范围内的变量。它将值放到action上下文。
1.servletactioncontext.getrequest().setattribute("list", list);在页面端是不能用el表达式直接取集合里对象的属性的,必须要选遍历出来集合,然后通集合里对象用点导航取对象的属性request = servletactioncontext.getrequest();session = servletactioncontext.getrequest().getsession();struts2提供了这样一个静态的类,可以直接获取request,session   2.实现servletrequestaware接口加个 ...
1.当使用type=“redirectaction” 或type=“redirect”提交到一个action并且需要传递一个参数时。这里是有区别的: 使用type=“redirectaction”时,结果就只能写action的配置名,不能带有后缀:“.action”     2.在action中定义:private user user;user有get/set方法。el取值:${user.username}struts2取值: //从valuestack中取值或
http://wenku.baidu.com/view/e0fa4e3610661ed9ad51f3d0.html  百度文档   1.不识别struts2标签:  严重: servlet.service() for servlet jsp threw exceptionthe struts dispatcher cannot be found.  this is usually caused by using struts tags without the associated filter. struts tags are only usable when the request ha ...
与jsp在html页面中嵌入java脚本代码不同,freemarker不支持脚本代码。   1.freemarker基本对象类型: 保存单值的变量(size,price,)称为scalar(标量).        ${root.size} 另外一种变量类型是:sequence(序列).在
struts2类型转换: 在基于http协议的web应用中,客户端(浏览器)和服务器之间传输的都是字符串形式的数据,换句话说,服务器接收到的用户数据只能是字符串或者字符数组,但在服务器端的java程序中,数据是有各种类型的,如int,float,date等,以及各种自定义的数据类型。   1.  从页面上传入list到服务端:
ognl表达式: 1.  不要忽略了用于界定整个常量字符串的单引号。   2.操作符: 逗号操作符: ,                   例如: name,#manager.name  显示的是#manager.name 花括号操作符:{}              
1.留言本   http://www.blogjava.net/rickhunter/category/3664.html   2.struts2 spring2 acegi:   3.workaction:   
  • 2009-07-29 13:15
  • 浏览 1125
 struts1要求action类继承一个抽象基类。struts1的一个普遍问题是使用抽象类编程而不是接口。• struts 2 action类可以实现一个action接口,也可实现其他接口,使可选和定制的服务成为可能。struts2提供一个actionsupport基类去实现常用的接口。action接口不是必须的,任何有execute标识的pojo对象都可以用作struts2的action对象。线程模式:• struts1 action是单例模式并且必须是线程安全的,因为仅有action的一个实例来处理所有的请求。单例策略限制了struts1 action能作的事,并且要在开发时特别小心。ac ...
  • 2009-07-29 11:02
  • 浏览 1013
 
1.在***action.properties中写中文:         在页面中显示乱码??
  • 2009-07-29 10:05
  • 浏览 794
1.caused by: com.opensymphony.xwork2.inject.containerimpl$missingdependencyexception: no mapping found for dependency [type=java.lang.string, name='actionpackages'] in public void org.apache.struts2.config.classpathpackageprovider.setactionpackages(java.lang.string).??   需要配置     < ...
  • 2009-07-27 09:51
  • 浏览 2982
http://www.family168.com/tutorial/springsecurity/html/jaas.html    spring/jaas http://www.blogjava.net/hengheng123456789/archive/2007/03/10/102983.html   jaas http://xy-z487.iteye.com/category/47271 tomcat   http://www.jdocs.com/tomcat/6.0.14/org/apache/catalina/realm/package-summary.html ream 两 ...
  • 2009-07-22 16:24
  • 浏览 1241
import com.opensymphony.xwork2.config.entities.parameterizable; public class staticparamsaction extends actionsupport implements parameterizable{                                     //staticparams private map map;        //把 xml文件中静态的值添加到map中必须实现parameterizable接口  public string execu ...
http://struts.apache.org/2.0.6/docs/codebehind-plugin.html   1.caused by: com.opensymphony.xwork2.inject.containerimpl$missingdependencyexception: no mapping found for dependency [type=java.lang.string, name='actionpackages']??            struts-prepare& ...
  • 2009-07-22 10:48
  • 浏览 1264
struts 2默认的表达式语言是ognl,原因是它相对其它表达式语言具有下面几大优势: 支持对象方法调用,如xxx.dosomespecial(); 支持类静态的方法调用和值访问,表达式的格式为@[类全名(包括包路径)]@[方法名 |  值名],例如:@java.lang.string@format('foo %s', 'bar')或@tutorial.myconstant@app_name; 支持赋值操作和表达式串联,如price=100, discount=0.8, calculateprice(),这个表达式会返回80; 访问ognl上下文(ognl context)和a ...
  • 2009-07-22 10:14
  • 浏览 1050
http://www.blogjava.net/max/archive/2007/08/16/137363.html     http://chengyue2007.iteye.com/blog/734377   spring 整合dwr
通配符方式:              action调用的例子:addcrud.action,updatecrud.action,deletecrud.action分割符加上*:                    
  • 2009-07-22 09:44
  • 浏览 1081
global site tag (gtag.js) - google analytics
网站地图