Recent Notes

Displaying keyword search results 1 - 11
Created by Fang on April 16, 2012 13:32:10    Last update: April 16, 2012 13:32:10
There are two steps to create a custom function for JSP: Declare the function in the TLD: <?xml version="1.0" encoding="UTF-8" ?> <taglib... Implement the function (must be static): package com.example; public class UrlTransl... To use the function: <%@ taglib uri="" p...
Created by Fang on January 31, 2012 15:40:34    Last update: January 31, 2012 15:41:28
This is a simple Hello World application with Spring 3 MVC. Like the default Apache HTTPd welcome page, it displays " It works! " when successfully deployed. The sole purpose is to show the minimum elements needed to setup Spring 3 MVC. I use Maven since it's so much easier than downloading the dependencies manually. Directory layout: ./src ./src/main ./src/main/webapp ./src/... pom.xml : <?xml version="1.0" encoding="UTF-8"?> <project... WEB-INF/web.xml : <?xml version="1.0" encoding="UTF-8"?> <web-app... WEB-INF/applicationContext.xml (empty, but needed): <?xml version="1.0" encoding="UTF-8"?> <beans x... WEB-INF/spring-servlet.xml : <?xml version="1.0" encoding="UTF-8"?> <beans x... WEB-INF/jsp/home.jsp : <!DOCTYPE html> <html> <head> <title>H... Build with: mvn clean package The resulting webapp is target/springmvc.war .
Created by freyo on May 13, 2011 15:45:29    Last update: September 20, 2011 08:08:12
This is an Android app that dumps any binarized xml file as plain text - to the sdcard on the device or emulator. build.xml : <?xml version="1.0" encoding="UTF-8"?> <project... AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <man... res/layout/main.xml <?xml version="1.0" encoding="utf-8"?> <Lin... res/values/strings.xml : <?xml version="1.0" encoding="utf-8"?> <res... src/com/android/xmltool/ package; import java.ut... Screenshot Pre-built APK can be downloaded from:
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/1.0 ... or, headers and page together (dump headers to stdout): $ curl --dump-header - HTTP/... Download openssl from curl C:\>curl --help Usage: curl [options...] <url> ...
Created by Fang on April 02, 2010 21:45:47    Last update: July 17, 2010 02:55:06
This is built upon the simple test application for JSTL , which contained a single servlet and a single JSP page. If I want to use it to test all available JSTL tags, the servlet and JSP page would be too complicated. Instead, I want to group the JSTL tags into separate JSP pages and display each group based on the requested URL. For example, if the URL ends with /CoreBasic , I'll display a page that contains the basic core tags; if the URL ends with /I18N , I'll display a page that contains the internationalization tags (e.g., <fmt:message> ). Furthermore, I want to delegate the handling of each group of tags to separate Java classes. This is the application I'll use for the...
Created by nogeek on April 25, 2010 05:09:14    Last update: April 25, 2010 05:10:46
Oracle Web Cache version used: Oracle Application Server Web Cache ... The test page is a simple Struts action sending a URL redirect: public ActionForward execute(ActionMapping map... Web Cache setup Origin server Host Name Port 7777 Site Host Name Port URL Path Prefix 80 Test results Request directly to the OC4J (Oracle Application Server): C:\work\testAppWebApp2>curl --dump-header - http:/... Request to Oracle Web Cache: C:\work\testAppWebApp2>curl --dump-header - http:/... Notice that Oracle Web Cache correctly translated the host name in the header and HTML page. However, the port number remained that of the Oracle App Server.
Created by Fang on April 01, 2010 22:24:58    Last update: April 02, 2010 02:49:38
In this note I'll show you how to create and package a JSP custom tag. The purpose of this tag is to display a random splash image for a home page, among a set of images. We should be able to add or delete candidate splash images from the WAR archive without the need to change the JSP. This is the intended use of the tag: <%@ taglib uri="" prefix... In the above example you provide a set of images named splash*.png (e.g., splash1.png, spalsh2.png, ...), and the tag will pick a random one to display when the JSP is rendered. Let's get started. I'll use Maven for this purpose. Create the standard Maven directory structure ./pom.xml ./src ./src/main ./src/main/jav... pom.xml <project xmlns=""... package tagdemo; import java.util.ArrayList......
Created by Fang on September 07, 2009 16:39:37    Last update: September 07, 2009 18:43:04
It's easiest to use the archetype plugin to start a new Maven project. I'll use struts 1 as example since it's not in the built-in archetypes for archetype:generate . Generate a simple webapp with archetype:generate : C:\work\maven>mvn archetype:generate -DarchetypeAr... It generates a directory structure like this: struts1app struts1app/pom.xml struts1app/src... with a simple POM: <project xmlns=""... Create settings.xml in $HOME/.m2 , add repository for Java EE dependencies: <?xml version="1.0" encoding="UTF-8"?> <setting... Add Java EE and Struts dependencies in pom.xml . Note that the Java EE dependency has scope provided , meaning that the web app container provides the jars, therefore we don't need to bundle them with our war fie. <project xmlns=""... Create a directory named java under main , create the Struts form and...
Created by Dr. Xi on October 23, 2008 03:54:04    Last update: October 23, 2008 03:57:44
Add validator plugin in struts-config.xml <struts-config> . . . ... Set validate="true" on action form <struts-config> <!-- ========== Form Bean De... Add validation rules in validation.xml <?xml version='1.0' encoding='windows-1252'?> <... If you override validate , make sure super.validate is called. package com.example; import javax.servlet.h... Read the documentation:
Created by Dr. Xi on December 12, 2007 20:30:01    Last update: December 12, 2007 20:32:23
This is a script to tail a log file through the web browser. It uses AJAX, apache web server, mod_python, UNIX utilities tail (requires the --lines switch) and wc . The log file may reside on the web server or any other host accessible from the web server through SSH. Although it's written in python, it should be easy to port to other languages such as Perl. Apache httpd.conf : LoadModule python_module modules/ ... Python script: import time, os from os.path import basename ...
Created by Dr. Xi on August 10, 2007 21:05:26    Last update: August 10, 2007 21:05:26
This style sheet transforms the struts-config.xml into HTML for easy viewing in a browser. It uses the DHTML JavaScript tooltip from . <?xml version="1.0" encoding="UTF-8"?> <xsl...