Recent Notes

Displaying keyword search results 1 - 10
Created by Fang on April 16, 2012 12:58:35    Last update: April 16, 2012 12:58:35
To implement a JSP custom tag with dynamic attributes (for example, to pass-thru arbitrary attributes not handled by the JSP tag): Set the dynamic-attributes element to true in the TLD: <tag> <name>mark</name> <tag-class>c... The tag handler must implement javax.servlet.jsp.tagext.DynamicAttributes : package com.example.jsp; import java.io.*; ...
Created by Fang on November 22, 2011 10:40:16    Last update: November 22, 2011 10:40:16
This is an example that uses tag handler, UI component and renderer together to support a custom taglib. The main purpose is to show how these components play together. The tag renders <ui:param name="extra" value="el interpreted"/> ... as <h3>my:foreach</h3> <ul class="css class" extra... These are the files: The tag handler ( src/main/java/com/example/ForeachTagHandler.java ): package com.example; import java.util.Map; ... The UI component ( src/main/java/com/example/UIForeach.java ): package com.example; import java.io.IOExcep... The renderer ( src/main/java/com/example/ForeachRenderer.java ): package com.example; import java.io.IOExcep... Faces config ( src/main/resources/META-INF/faces-config.xml ): <?xml version="1.0" encoding="UTF-8"?> <faces-c... Taglib config ( src/main/resources/META-INF/foreach.taglib.xml ): <?xml version="1.0" encoding="UTF-8"?> <facelet...
Created by Fang on November 10, 2011 09:26:12    Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines! <?xml version="1.0" encoding="UTF-8"?> <xsd:sch...
Created by Fang on November 02, 2011 16:40:10    Last update: November 02, 2011 16:40:10
Facelet taglib schema from JavaServer Faces Spec 2.0: <xsd:schema targetNamespace="http://java.sun.com/x...
Created by Dr. Xi on April 19, 2011 16:02:55    Last update: April 19, 2011 16:03:24
Method Description object.__getattr__(self,name) Called when an attribute lookup has not found the attribute in the usual places (i.e. it is not an instance attribute nor is it found in the class tree for self ). object.__setattr__(self,name,value) Called when an attribute assignment is attempted. This is called instead of the normal mechanism (i.e. store the value in the instance dictionary). If __setattr__() wants to assign to an instance attribute, it should not simply execute self.name = value — this would cause a recursive call to itself. Instead, for new style classes, it should call the base class method with the same name, for example, object.__setattr__(self, name, value) . For classic classes, it should insert the value in the dictionary of instance attributes, e.g., self.__dict__ [name] =...
Created by James on October 21, 2010 19:48:36    Last update: October 21, 2010 19:50:43
Use the in operator to enumerate over an object's properties: Use the in operator to list all properties of an object Call the hasOwnProperty function to determine if the property is a direct attribute of the current object, i.e., not some attribute defined somewhere up the prototype chain. Test code (copy and paste to the JavaScript Executor ): function BaseClass() { this.p1 = 'parent.p1... Note that intrinsic attributes such as constructor , prototype are not listed by the in operator.
Created by Fang on August 24, 2010 18:44:24    Last update: August 24, 2010 18:44:24
The tags XML transform tags apply XSLT to XML documents. The XML document may be specified as the doc attribute or enclosed as the body of the <x:transform> tag. Optional <x:param> tags may be used to specify parameters for the XSLT. <x:transform> Syntax: <x:transform doc="XMLDocument" xslt="XSLTStyle... or, include the XML document in the body: <x:transform xslt="XSLTStylesheet" [docSystem... Attributes: Name Dynamic? Type Description doc true String , Reader , javax.xml.transform.Source , org.w3c.dom.Document , or object exported by <x:parse> , <x:set> . Source XML document to be transformed. (If exported by <x:set> , it must correspond to a well-formed XML document, not a partial document.) xslt true String , Reader or javax.xml.transform.Source Transformation stylesheet as a String , Reader , or Source object. docSystemId true...
Created by Fang on August 19, 2010 18:32:28    Last update: August 19, 2010 18:32:28
The tags <x:parse> Parses an XML document. The document to be parsed can be specified by the doc attribute or enclosed as the body of the tag. The parsed document is exposed as the var attribute or the varDom attribute. When exposed as var , the type of the exposed object is implementation dependent; when exposed as varDom , the type of the exposed object is org.w3c.dom.Document . Objects exposed by var and varDom can both be used to set the context of an XPath expression. Syntax: <x:parse doc="XMLDocument" {var="var" [sco... or, put the XML document in the element body: <x:parse {var="var" [scope="page|request|s... Attributes: Name Dynamic? Type Description doc true String , Reader Source XML document to be parsed. systemId true String The...
Created by meiu on July 07, 2010 15:16:34    Last update: July 07, 2010 15:17:08
Example: <%@ taglib prefix="fmt" uri="http://java.sun.com/j... Full attributes: Attribute Meaning value Date object to be formatted type Format time only ('time'), date only ('date'), or both date and time ('both')? dateStyle Style to format date, e.g., default, short, long, full etc (c.f. JavaDoc for java.text.DateFormat) timeStyle Style for format time, e.g., default, short, long, full etc (c.f. JavaDoc for java.text.DateFormat) pattern User defined pattern, e.g., MM/dd/yyyy timeZone Which time zone to display the date for? var If the var attribute is specified, then a String value containing the formatted date is assigned to the named variable. Otherwise, the <fmt:formatDate> tag will write out the formatting results. scope When the var attribute is present, the scope attribute specifies the scope of the resulting variable. .
Created by Dr. Xi on November 15, 2007 04:40:44    Last update: November 15, 2007 04:40:44
Here's some simple Ajax code. The Ajax response is delivered as XML with attributes and an array of data payloads contained in CDATA sections: <?xml version="1.0" encoding="utf-8"?> <ajax-re... And the JavaScript that does the Ajax magic: // ajax.js function ajaxGet(url, ajaxCallback) ... And the HTML test code: <html> <head> <script language="JavaScript"...