Displaying keyword search results 1 - 7
Created by Fang on January 28, 2012 13:24:09 Last update: January 28, 2012 13:31:22
This is a simple JSP custom tags library with tag body. Just like the JSF counterpart , it splits a string and repeats the body for each word, i.e., with this markup:
<%@ taglib uri="http://custom.tag.com/demo" prefix...output:
<html> <body> <p>Hello Tigger!</p> <p>H...With Maven, this is the directory structure:
./src ./src/main ./src/main/resources ./s...There are three files to write: pom.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0"...src/main/java/tagdemo/IterateTag.java :
package tagdemo; import java.io.IOException...src/main/resources/META-INF/demotag.tld :
<?xml version="1.0" encoding="UTF-8"?> <!DO...Build with:
mvn clean installTo use it as a dependency in other Maven projects:
<dependency> <groupId>tag-demo</groupId> ...
Created by freyo on May 17, 2011 11:13:17 Last update: May 17, 2011 11:13:17
This is an odd-ball content provider in that it doesn't provide database records, but provides a resource as a stream. It can be used to provide media files or XML resources. Start the project with:
tools/android create project --package com.android...Create assets directory and add an XML file ( assets/demo.xml ):
<? xml version="1.0" encoding="UTF-8"?> <people...Edit the layout ( res/layout/main.xml ):
<?xml version="1.0" encoding="utf-8"?> <LinearL...Edit src/com/android/cptest/Dummy.java :
package com.android.cptest; import java.io....Add content provider ( src/com/android/cptest/XmlResource.java ):
package com.android.cptest; import java.io....Update AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?> <manifes...Add this section to the end of build.xml :
<target name="-package-resources"> <ech...Build and install:
ant installScreenshot: Remove the Dummy activity ( AndroidManifest.xml ):
<?xml version="1.0" encoding="utf-8"?> <manifes...Create a new project for...
Created by freyo on April 12, 2011 15:13:32 Last update: May 03, 2011 15:20:55
Create new project
$ tools/android create project \ > --package co...Edit res/values/string.xml , add strings for the main screen.
<?xml version="1.0" encoding="utf-8"?> <resourc...Add widgets to main layout ( res/layout/main.xml ).
<?xml version="1.0" encoding="utf-8"?> <LinearL...Edit src/com/android/apkinfo/GetAPKPermissions.java and change contents to:
package com.android.apkinfo; import android...Install the debug package to the emulator:
ant installThe screen should look like: Add display permissions activity. Start by creating a new layout res/layout/display_permissions.xml :
<?xml version="1.0" encoding="utf-8"?> <LinearL...Add the strings used by the new Activity ( res/values/strings.xml ):
<?xml version="1.0" encoding="utf-8"?> <resourc...Add the Display Permissions Activity ( src/com/android/apkinfo/DisplayPermissions.java ):
package com.android.apkinfo; import android...Change src/com/android/apkinfo/GetAPKPermissions.java to invoke the Display Permissions Activity:
package com.android.apkinfo; import android...Declare Display Permissions Activity in AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?> <manifes......
Created by freyo on April 18, 2011 15:08:21 Last update: April 18, 2011 15:12:20
Generate android project
$ ~/android-sdk-linux_86/tools/android create proj...Create XML file res/xml/books.xml :
<?xml version="1.0"?> <catalog> <book id=...Edit layout ( res/layout/main.xml ):
<?xml version="1.0" encoding="utf-8"?> <Lin...Edit code ( src/com/android/xmlres/XMLResource.java ):
package com.android.xmlres; import java.io....Change activity label from app_name to booklist ( AndroidManifest.xml ):
<?xml version="1.0" encoding="utf-8"?> <manifes...Add value for string resource ( res/values/string.xml ):
<?xml version="1.0" encoding="utf-8"?> <resourc...Deploy and test:
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 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="http://custom.tag.com/demo" 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
package tagdemo; import java.util.ArrayList......
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/mod_python.so ...Python script:
import time, os from os.path import basename ...