Displaying keyword search results 11 - 20
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 March 03, 2010 05:16:40 Last update: October 31, 2011 10:22:51
Implicit variables are always available to JSTL - you don't need to set them before using them. Page context: pageContext pageContext properties: Name Type Description page javax.servlet.Servlet The current servlet request request javax.servlet.ServletRequest The current servlet request response javax.servlet.ServletResponse The current servlet response servletConfig javax.servlet.ServletConfig The servlet config servletContext javax.servlet.ServletContext The application session javax.servlet.http.HttpSession The current HTTP session Note: request , response etc., is not directly available, you access them with pageContext.request , pageContext.response , etc. Scope variables: pageScope, requestScope, sessionScope, applicationScope Name Type Description pageScope java.util.Map Name-value pair of page scoped variables requestScope java.util.Map Name-value pair of request scoped variables sessionScope java.util.Map Name-value pair of session scoped variables applicationScope java.util.Map Name-value pair of application scoped variables Parameters, HTTP headers and cookies: param, paramValues, header,...
Created by Fang on October 28, 2011 13:49:40 Last update: October 30, 2011 19:23:25
This is a simple example to demonstrate the templating power of JSF facelets. If you've used struts tiles before, you'll recognize the simplicity of templating with facelets. I've stripped out everything else except the pages themselves, just to put our focus on facelets. This is a Maven based project, and you need Tomcat (or any servlet container) to run the resulting webapp. To begin with this is the list of files:
./pom.xml ./src/main/webapp/home.xhtml ./src...I left faces-config.xml in there for completeness sake, it may not be needed. The Maven POM ( pom.xml ):
<?xml version="1.0" encoding="UTF-8"?> <project...Web app configuration ( WEB-INF/web.xml ):
<?xml version="1.0" encoding="UTF-8"?> <web-app...Empty WEB-INF/faces-config.xml :
<?xml version="1.0" encoding="UTF-8"?> <!-- Thi...index.jsp is simply a redirect to home.jsf :
<% response.sendRedirect("home.jsf"); %>...
Created by freyo on August 25, 2011 09:07:40 Last update: August 25, 2011 20:45:43
This is a list of built-in Android permission values: Permission Description Since API Level android.permission.ACCESS_CHECKIN_PROPERTIES Allows read/write access to the "properties" table in the checkin database, to change values that get uploaded. 1 android.permission.ACCESS_COARSE_LOCATION Allows an application to access coarse (e.g., Cell-ID, WiFi) location 1 android.permission.ACCESS_FINE_LOCATION Allows an application to access fine (e.g., GPS) location 1 android.permission.ACCESS_LOCATION_EXTRA_COMMANDS Allows an application to access extra location provider commands 1 android.permission.ACCESS_MOCK_LOCATION Allows an application to create mock location providers for testing 1 android.permission.ACCESS_NETWORK_STATE Allows applications to access information about networks 1 android.permission.ACCESS_SURFACE_FLINGER Allows an application to use SurfaceFlinger's low level features 1 android.permission.ACCESS_WIFI_STATE Allows applications to access information about Wi-Fi networks 1 android.permission.ACCOUNT_MANAGER Allows applications to call into AccountAuthenticators. Only the system can get this permission. 5 android.permission.AUTHENTICATE_ACCOUNTS...
Created by freyo on April 01, 2011 14:29:25 Last update: June 29, 2011 13:58:27
Start the emulator ( create an AVD if none exists)
$ tools/emulator -avd Simple8Create new project
$ tools/android create project \ > --package co...where " --target 2 " identifies the target platform as displayed by " tools/android list targets ", which is stored in the properties file default.properties in the project root folder. cd HelloWorld and install debug package onto the running emulator:
$ ant install Buildfile: build.xml [set...Launch the Hello World application on the emulator. You'll see something like this: Edit res/values/string.xml , change the contents to:
<?xml version="1.0" encoding="utf-8"?> <resourc...Edit res/layout/main.xml , change the contents to:
<?xml version="1.0" encoding="utf-8"?> <LinearL...The contents of the text area now refer to a string defined in the resource file strings.xml , instead...
Created by Dr. Xi on April 27, 2011 08:28:31 Last update: April 27, 2011 08:37:40
JBoss example with hsql:
<persistence> <persistence-unit name="myapp"...MySQL example with JDBC :
<persistence xmlns="http://java.sun.com/xml...With OpenEJB transaction manager:
<persistence version="1.0" xmlns="...With EclipseLink :
<?xml version="1.0" encoding="UTF-8"?> <persist...
Created by Dr. Xi on September 29, 2010 16:28:52 Last update: September 29, 2010 16:28:52
Use the replace task with replacefilter to replace multiple tokens:
Created by Fang on August 03, 2010 19:50:51 Last update: August 03, 2010 19:50:51
The tags <fmt:message> Writes out a formatted message for the current locale and resource bundle, or stores the resulting message to a scoped variable (when the var attribute is specified). Syntax:
<fmt:message key="messageKey" [bundle="resourc...Or, with parameters in body:
<fmt:message key="messageKey" [bundle="resourc...<fmt:bundle> Creates a resource bundle for the contained body. Syntax:
<fmt:bundle basename="basename" [prefix="prefi...<fmt:setBundle> Sets a resource bundle in a scoped variable, which may be used later by <fmt:message> . Syntax:
<fmt:setBundle basename="basename" [var="varNa...<fmt:param> This is used inside a <fmt:message> tag to specify a replacement parameter.
<fmt:param>The Parameter Value</fmt:param>Test it Make these additions to the expanded test application : Create 3 resource bundles and place them under src\main\resources . messages_en.properties :
label.login=Login label.username=User Name ...messages_es.properties :...
Created by Dr. Xi on July 19, 2010 21:58:34 Last update: July 23, 2010 21:37:23
Parsing XML in Java is really simple:
import java.io.*; import javax.xml.parsers.Docu...The parser implementation details are hidden behind the JAXP API. In case you want to know which parser implementation is used, this is what the JavaDoc for DocumentBuilderFactory.newInstance says: Use the javax.xml.parsers.DocumentBuilderFactory system property. Use the properties file " lib/jaxp.properties " in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to...