Displaying keyword search results 21 - 27
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 Fang on August 13, 2009 02:59:06 Last update: January 09, 2010 23:36:44
Maven requires JAVA_HOME to be set but the setting is tricky. It doesn't like a PATH inside quotes with a space in it.
C:\>@rem quotes and space doesn't work C:\>set ...
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="http://maven.apache.org/POM/4.0.0"...Create settings.xml in $HOME/.m2 , add Java.net 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="http://maven.apache.org/POM/4.0.0"...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: http://struts.apache.org/1.2.4/userGuide/dev_validator.html
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 ...
Created by Dr. Xi on August 10, 2007 21:05:26 Last update: August 10, 2007 21:05:26
<?xml version="1.0" encoding="UTF-8"?> <xsl...
Created by Dr. Xi on May 08, 2007 23:09:39 Last update: May 08, 2007 23:13:07
First create a resource provider for Oracle AQ in orion-application.xml:
<?xml version = '1.0' encoding = 'windows-1252...Then, hook up the EJB to the queue in orion-ejb-jar.xml:
<?xml version = '1.0' encoding = 'windows-1252...Make sure the resource names ('rsname') match among the xml files. Full information is available from the Oracle document titled "Oracle Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.1.0)". Look at Appendix A.