Recent Notes

Displaying keyword search results 1 - 7
Created by Fang on November 21, 2011 15:57:49    Last update: November 22, 2011 09:51:26
The improved custom taglib works with existing facelet ui taglibs. For example: <ui:param name="theName" value="John"/> <my:hel... produces the expected output. However, a problem exists with the ui:repeat tag: <h3>With ui:repeat</h3> <ui:repeat var="theName... When tested with a URL like: http://localhost:8080/facelet-demo/?name=Zack&name... the raw EL prints out the correct names, but my custom tag substitutes empty string for theName2 ! In theory, the response is rendered in the Render Response phase, way after the Apply Request Values phase, actual values should be available to EL. The answer to this anomaly turned out to be very deep ! Yes, right there in the code! I would consider this a bug in facelets implementation, but the JSF spec did not tell what the expected behavior should be. In my custom...
Created by Fang on November 21, 2011 13:49:11    Last update: November 21, 2011 13:49:11
In the test for the simple taglib example , I used a literal string for the name attribute: <my:hello name="Jack"/> What happens if the name attribute contains EL expresson? For example: <my:hello name="#{param['name']}"/> If EL works, the tag should take the value of the " name " request parameter and print it out. But the tag as implemented in the simple taglib example prints the literal string: Hello #{param['name']}! I am FaceletTag. In order to make a tag to recognize EL, we have to use TagAttribute.getValue(FaceletContext ctx) instead of TagAttribute.getValue() . The latter returns the literal value of the attribute. The HelloTagHandler should be changed to: package com.example; import java.io.IOExcep... Rebuild the taglib and test with a URL like this: http://localhost:8080/facelet-test/?name=Jack The tag will print:...
Created by Dr. Xi on November 23, 2010 22:11:54    Last update: November 23, 2010 22:12:49
JavaDoc says that you can call getOutputStream or getWriter on ServletResponse , but you cannot call both. The second call will get IllegalStateException . So this works: import java.io.*; import javax.servlet.*; im... So does this: import java.io.*; import javax.servlet.*; im... But not this: import java.io.*; import javax.servlet.*; im... You can make the last servlet work if you insert a filter like this: import java.io.*; import javax.servlet.*; im... But depending on the underlying implementation, the order of the output strings may be undetermined.
Created by Fang on August 23, 2010 22:55:58    Last update: August 24, 2010 15:45:04
The tags XML flow control tags are exactly the same as their Core flow control equivalents, except that the test condition with a boolean EL expression is replaced by the select condition with an XPath expression. In the case of the forEach tag, the items attribute is replaced with the select attribute. In a test condition, the XPath expression is evaluated to a boolean value by the rules of the XPath boolean() function, which converts its argument to a boolean as follows: a number is true if and only if it is neither positive or negative zero nor NaN. a node-set is true if and only if it is non-empty. a string is true if and only if its length is non-zero. an object of...
Created by Fang on July 26, 2010 19:18:28    Last update: August 18, 2010 19:13:02
The tags <c:import> The <c:import> tag imports the contents of a URL and expose that in one of three ways: Import contents from a URL and write it out to the page (url may be relative or absolute): <c:import url="theUrl" /> Import contents from a URL and save it to a scoped variable string named by the var attribute. Use the scope attribute to define the scope of the exported variable. <c:import url="theUrl" var="importTest" scope="ses... Import a URL and expose to a Reader object named by the varReader attribute. The scope attribute does not apply. The varReader scoped variable can only be accessed within the body of <c:import> . <c:import url="theUrl" varReader="theReader"/> <c:url> The <c:url> tag constructs a URL and writes it out to the...
Created by voodoo on July 11, 2009 15:14:55    Last update: July 29, 2010 22:45:48
cURL is a command line tool for transferring files with URL syntax. The main purpose and use for cURL is to automate unattended file transfers or sequences of operations. It's really easy to see HTTP headers with curl: C:\>curl --head http://www.google.com HTTP/1.0 ... or, headers and page together (dump headers to stdout): $ curl --dump-header - http://www.google.com HTTP/... Download openssl from openssl.org: curl http://www.openssl.org/source/openssl-0.9.6m.... C:\>curl --help Usage: curl [options...] <url> ...
Created by Dr. Xi on October 18, 2008 03:16:24    Last update: October 18, 2008 03:17:21
Normally the browser opens a page if it knows how to. For example, text files are usually displayed in the browser window. You can set the Content-Type and Content-Disposition headers in the HTTP response to force the browser to popup the download dialog. Python example: def download_log(req, app = None, file = None): ... Java example: public void service(HttpServletRequest req, Ht...