Displaying keyword search results 1 - 10
Created by zhidao on January 25, 2012 19:27:53 Last update: January 25, 2012 19:28:47
The spring MVC annotation-driven declaration:
<?xml version="1.0" encoding="UTF-8"?> <beans x...does the following magic : Among others, registers: RequestMappingHandlerMapping RequestMappingHandlerAdapter ExceptionHandlerExceptionResolver in support of processing requests with annotated controller methods using annotations such as @RequestMapping , @ExceptionHandler , etc. Enables Spring 3 style type conversion through a ConversionService instance in addition to the JavaBeans PropertyEditors used for Data Binding. Enables support for formatting Number fields using the @NumberFormat annotation through the ConversionService . Enables support for formatting Date, Calendar, Long, and Joda Time fields using the @DateTimeFormat annotation, if Joda Time 1.3 or higher is present on the classpath. Enables support for validating @Controller inputs with @Valid , if a JSR-303 Provider is present on the classpath. Enables HttpMessageConverter support for @RequestBody method parameters and...
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 10, 2011 09:26:12 Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines!
<?xml version="1.0" encoding="UTF-8"?> <xsd:sch...
Created by Fang on September 07, 2009 20:44:15 Last update: November 03, 2011 14:43:19
Step 1: Repackage a web app as EAR A Java EE application is a multimodule Maven project. At the very least you'll need to package a WAR and an EAR. To get started, I'll simply re-package the simple webapp as an EAR. Create a directory named javaee-app Copy the webapp from here to javaee-app . Rename struts1app to webapp . Create pom.xml under javaee-app :
<project> <modelVersion>4.0.0</modelVersion>...Create a directory named ear under javaee-app . Create pom.xml under ear :
<project> <modelVersion>4.0.0</modelVersion>...Modify pom.xml in the webapp directory so that it looks like this:
<project> <modelVersion>4.0.0</modelVersion> ...Build with " mvn package " in the javaee-app directory. You can see that ear-1.0.ear is successfully generated in javaee-app/ear/target . Maven successfully resolves dependencies between the sub-projects....
Created by Fang on November 02, 2011 16:40:10 Last update: November 02, 2011 16:40:10
Facelet taglib schema from JavaServer Faces Spec 2.0:
Created by Fang on October 30, 2011 20:35:17 Last update: October 30, 2011 20:37:03
This note lists some of the different behaviors I found using different JSF implementations. In the simple JSF facelet example, I used Sun's reference implementation version 2.0.0-RC:
<dependency> <groupId>javax.faces</gro...With this version, the DOCTYPE declaration is dropped when the page is rendered. It doesn't matter what DOCTYPE you declare in your templates, the facelet engine simply drops it. The problem with this is, your page is always displayed in quirks mode , despite your intentions to require standards compliant mode. The DOCTYPE problem is fixed in release 2.0.2-FCS . Change the dependency in pom.xml to:
<dependency> <groupId>javax.faces</gro...and test again, you'll find that DOCTYPE is faithfully passed over to the browser (view source at browser). You can delete the DOCTYPE declaration in the xhtml template...
Created by freyo on September 09, 2011 11:43:36 Last update: September 09, 2011 11:45:45
When you run automated Android tests with Eclipse or from the command line, you get text output, which isn't good for reporting purposes. If you run a large set of test cases with automated build, the text report isn't very helpful. Fortunately, Android CTS generates test reports in XML with accompanying XSL to make it look nice in a browser. To run your own tests with Android CTS: Download Android CTS Make a new directory MyRepository under android-cts , alongside the existing repository directory. Copy host_config.xml from repository to MyRepository Create directory plans under MyRepository , add a test plan ( MyTests.xml ):
<?xml version="1.0" encoding="UTF-8"?> <TestPla...Create directory testcases under MyRepository . Copy TestDeviceSetup.apk from repository/testcases to MyRepository/testcases Under MyRepository/testcases , create a test...
Created by freyo on September 07, 2011 16:46:14 Last update: September 07, 2011 19:23:00
The Android unit test framework is based on JUnit 3 , not JUnit 4. Test cases have to extend junit.framework.TestCase or a subclass (such as android.test.InstrumentationTestCase ). Tests are identified by public methods whose name starts with test , not methods annotated with @Test (as in JUnit 4). An Android test suite is packaged as an APK, just like the application being tested. To create a test package, first you need to identify the application package it is testing. Google suggests to put the test package source in a directory named tests/ alongside the src/ directory of the main application. At runtime, Android instrumentation loads both the test package and the application under test into the same process. Therefore, the tests can invoke methods on...
Created by freyo on August 31, 2011 15:49:54 Last update: August 31, 2011 15:49:54
Got this error while trying to build Android app:
[apkbuilder] Creating AppInfo-debug-unaligned.ap...Solution: Delete the Android debug keystore:
$ rm ~/.android/debug.keystoreBuild again:
$ ant debugThe new key is valid for 30 years (keystore password is 'android'):
$ keytool -list -v -keystore ~/.android/debug.keys...
Created by alfa on July 01, 2011 13:16:12 Last update: July 01, 2011 13:16:12
This is a simple doclet that prints all public methods and their parameter names and types. Code
import com.sun.javadoc.*; public class List...Compile
javac -cp $JAVA_HOME/lib/tools.jar:. ListMethodsDo...Use
javadoc -doclet ListMethodsDoclet -sourcepath /pat...