Java

Portlet V.S. Servlet

Portlets are similar to servlets, in that:    1. Portlets are managed by a specialized container.    2. Portlets generate dynamic content.    3. A portlet’s life cycle is managed by the container.    4. Portlets interact with web client via a request/response paradigm. Portlets are different from servlets, in that:    1. Portlets only …

Portlet V.S. Servlet Read More »

[Rod Johnson] 不打包,直接部署一个文件夹

我以前就是这样做的,自我感觉挺轻便,却被别人强烈鄙视,说是不合规范! 现在你看,Rod Johnson自己都这么做,还有什么可说的? 这样做还有个好处:“The advantages of expanded deployment in development are that it often enables individual files to be updated without full redeployment”

JXPath

今天看到了Rod Johnson在他很久以前写的书上说, JXPath不错。 于是我去它的官方网站看了一下,确实很牛!看这一段就知道了! ====================================================== Address address = (Address)JXPathContext.newContext(vendor). getValue(“locations[address/zipCode=’90210′]/address”); This XPath expression is equivalent to the following Java code: Address address = null; Collection locations = vendor.getLocations(); Iterator it = locations.iterator(); while (it.hasNext()){ Location location = (Location)it.next(); String zipCode = location.getAddress().getZipCode(); if (zipCode.equals(“90210”)){ address = location.getAddress(); break; } }

[Rod Johnson] 集群环境下,修改Session数据后要立即rebind一下这个对象

原文说: "Thus, to ensure correct replication behavior, always rebind a session attribute when the session data is changed." 比如,假设session中现有这样一个对象    session.setAtrribute("employee", employee); 现在改变一下这个对象的值    employee.setName("Changed Name"); 那么当前服务器节点上, session.getAtrribute("employee").getName() 就自动变成了"Changed Name". 但是Cluster上的其他节点呢? 会不会自动更新? 不同的应用服务器有不同的实现。为了避免不一致的情况,应该在改变employee的值之后重新调用一下 session.setAtrribute("employee", employee),这样的话可以保证其它其他节点跟着一起更新,因为这是Servlet规范所规定的。