Recent Notes

Displaying keyword search results 1 - 4
Created by Dr. Xi on February 01, 2011 14:38:55    Last update: February 01, 2011 14:40:59
Create the stuff you want to manufacture with the factory: package tc.demo; public class Junk { ... Create the factory: package tc.demo; import java.util.Enumerati... Tell Tomcat to use your factory. Create file context.xml and put it under the directory META-INF of your web application: <Context> <Resource name="/find/junk/here" ... Note that beside name , type and factory , you can put any arbitrary attribute in the Resource element. Access the thing with JNDI: <%@page language="java" import="javax.naming.*,tc.... The server side log looked like this: INFO: jndiName: here INFO: name: scope, value: ... Also note that, in contrast to Tomcat documentation , resource-ref is not needed in web.xml .
Created by Dr. Xi on August 30, 2010 15:58:29    Last update: August 30, 2010 15:58:29
Python String does not have functions like substring or substr . Instead, substrings are specified with the slice notation : two indices separated by a colon. >>> s = 'readme.txt' >>> s.substring(0, 3) T...
Created by Fang on August 18, 2010 20:07:46    Last update: August 18, 2010 20:11:36
JSTL uses XPath expressions as a concise notation to specify or select parts of an XML document. JSTL provides EL like expressions to access web application data and comes with the core function library of the XPath specification. Accessing Web Application Data XPath Expression Mapping $foo pageContext.findAttribute("foo") $param:foo request.getParameter("foo") $header:foo request.getHeader("foo") $cookie:foo maps to the cookie's value for name foo $initParam:foo application.getInitParameter("foo") $pageScope:foo pageContext.getAttribute("foo", PageContext.PAGE_SCOPE) $requestScope:foo pageContext.getAttribute("foo", PageContext.REQUEST_SCOPE) $sessionScope:foo pageContext.getAttribute("foo", PageContext.SESSION_SCOPE) $applicationScope:foo pageContext.getAttribute("foo", PageContext.APPLICATION_SCOPE) For example, to find the bar element whose x attribute equals the value of the HTTP request parameter named paramName : /foo/bar[@x=$param:paramName] Java Type to XPath Type Mappings XPath Type Java Type java.lang.Boolean boolean java.lang.Number number java.lang.String string Object exported by <x:parse> node-set Please note that JSTL, as of version 1.2,...
Created by Dr. Xi on November 17, 2008 03:33:28    Last update: November 17, 2008 03:33:28
The __file__ attribute of a module tells you where a module come from: >>> import pkg_resources >>> pkg_resources.__fi...