Recent Notes

Displaying keyword search results 71 - 80
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 James on July 19, 2009 23:29:42    Last update: July 19, 2009 23:33:24
Existing techniques use background images to make round corners. I present a technique here that uses four foreground images: . I think this technique is easier to understand and use. The only requirements are: Add position: relative to the CSS for the box to be rounded Matching border and color between the box to be rounded and the corner images Here's the HTML with static elements: <!doctype html public '-//W3C//DTD HTML 4.01//EN' ... The markup is even easier if we use jQuery to add the corners dynamically: <!doctype html public '-//W3C//DTD HTML 4.01//EN' ... This is the result:
Created by Dr. Xi on January 29, 2009 21:33:44    Last update: January 30, 2009 17:43:33
You can use applet , object , or embed tags to embed an applet in your HTML page. However, The applet tag is interpreted by both IE and Mozilla family of browsers. The applet tag won't automatically download a JRE if the Java Plug-in isn't already installed. The object tag works only for IE The embed tag works only for Mozilla family of browsers, i.e., Firefox. Use applet tag: <applet code="MyApplet.class" width="200" ... Use object tag: <!-- latest JRE --> <OBJECT classid="clsid:... Use embed tag: <!-- highest JRE that supports MIME type ... Mixed object and embed tag: <object classid="clsid:8AD9C840-044E-11D1-B3E9... You need to use a different name for the Mozilla embed tag and use that name to refer to the applet...
Created by Dr. Xi on January 30, 2009 16:57:12    Last update: January 30, 2009 17:25:36
The scriptable attribute defaults to false . However, even when you set it to true , there is a time delay between when the applet is loaded and when it becomes scriptable . The following code may fail: <html><body> <object classid="clsid:8AD9C840-04... You need to wrap the JavaScript like this: <script language="JavaScript" type="text/javascrip...
Created by Dr. Xi on November 20, 2008 00:35:38    Last update: November 20, 2008 00:36:43
This is from: Using and Programming Generics in J2SE 5.0 There are three types of wildcards: "? extends Type": Denotes a family of subtypes of type Type. This is the most useful wildcard "? super Type": Denotes a family of supertypes of type Type "?": Denotes the set of all types or any As an example of using wildcards, consider a draw() method that should be capable of drawing any shape such as circle, rectangle, and triangle. The implementation may look something like this. Here Shape is an abstract class with three subclasses: Circle , Rectangle , and Triangle . public void draw(List<Shape> shape) { for(Sha... It is worth noting that the draw() method can only be called on lists of Shape and cannot be...
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 October 16, 2008 23:09:28    Last update: October 17, 2008 03:30:38
import java.io.*; public class TestMSOffice...
Created by Dr. Xi on August 21, 2008 22:35:24    Last update: October 16, 2008 02:27:59
import java.net.*; import java.io.*; pub... An example for POSTing from Java is available from here: http://www.javaworld.com/javaworld/javatips/jw-javatip34.html
Created by Dr. Xi on September 13, 2008 20:13:48    Last update: September 13, 2008 20:14:05
Use CreditCardValidator to validate credit card number. You need the commons-validator.jar from apache. package example; import example.datatypes.C...
Created by Dr. Xi on September 07, 2008 03:56:00    Last update: September 07, 2008 04:05:51
The @Retention meta-annotation (annotations to annotate an Annotation Type) can have three values: RetentionPolicy.SOURCE - the annotation is source level, it's ignored by the compiler. RetentionPolicy.CLASS - the annotation is retained at compile time, but ignored by the VM at runtime ( this is the default ) RetentionPolicy.RUNTIME - the annotation is retained at runtime, you can use Java reflection to query the annotation For example: import java.lang.annotation.*; // if @Target is... At runtime, a program can query the annotations through the java.lang.reflect.AnnotatedElement interface, which is implemented by java.lang.Class , java.lang.reflect.Constructor , java.lang.reflect.Field and java.lang.reflect.Method , among others. This is an example from Sun : import java.lang.reflect.*; public clas...
Previous  1 2 3 4 5 6 7 8 9 Next