Recent Notes

Displaying keyword search results 1 - 4
Created by Fang on November 08, 2011 20:55:00    Last update: November 21, 2011 18:19:44
In the simple taglib example , I used a tag handler class to implement a taglib. This is an example to implement a taglib with a UI component. The purpose is to use a custom tag to split a string and print each part in a separate paragraph, i.e., print <p>john</p> <p>steve</p> <p>mike</p> with custom tag <my:foreach> : <my:foreach var="who" value="john steve mike"> ... These are the files: pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0"... src/main/java/com/example/UIForeash.java : package com.example; import java.io.IOExcep... src/main/resources/META-INF/faces-config.xml : <?xml version="1.0" encoding="UTF-8"?> <faces-c... src/main/resources/META-INF/foreach.taglib.xml : <?xml version="1.0" encoding="UTF-8"?> <facelet... How to use: Put the JAR file generated by the above project in the WEB-INF/lib folder of the web app. If the web app is a Maven project, just add the taglib project as a dependency:...
Created by Fang on November 03, 2011 19:47:38    Last update: November 08, 2011 20:24:47
This is a step-by-step example to create a really simple facelet taglib (in JSF 2 with Maven). Create a simple Maven project with: mvn archetype:create -DgroupId=com.example -Dartif... Three files are created as a result: pom.xml src/main/java/com/example/App.java src/test/java/com/example/AppTest.java This project should be able to build with: mvn package Add facelet API dependencies to pom.xml : <project xmlns="http://maven.apache.org/POM/4.... The compiler plugin section is optional. Remove src/main/java/com/example/App.java , create a new Java class as the facelet Tag Handler ( HelloTagHandler.java ): package com.example; import java.io.IOExcep... This tag handler simply prints a "Hello" message. Create facelet tag declaration file src/main/resources/META-INF/hello.taglib.xml : <?xml version="1.0" encoding="UTF-8"?> <facelet... Build the JAR with mvn clean package Optionally, install it to the local repository: mvn install To use the taglib, simply drop the...
Created by freyo on May 20, 2011 09:25:20    Last update: May 23, 2011 12:11:42
The javax.xml.crypto and javax.xml.crypto.dsig packages are not available in Android (as of version 2.3). Therefore, standard Java API does not work. But you can use the Apache Santuario library to do that. Here are the steps: Download the xml security source distribution (curently version 1.4.4). Build with ant. Create your own library jar (only the apache classes, no javax): jar -cf xmlsec-1.4.4.jar -C build/classes org Copy xmlsec-1.4.4.jar to the libs directory of your Android project. Here's the Java code: import java.io.*; import javax.xml.parsers.*; ...
Created by Dr. Xi on January 08, 2010 03:53:37    Last update: January 08, 2010 03:54:56
This is an Ant custom task to merge Properties files I lifted from http://marc.info/?l=ant-user&m=106442688632164&w=2 , with some minor bug fixes. Example usage: <taskdef name="mergeProperty" classname="ant.task.... Implementation: package ant.task.addon; import java.io.Buff...