Recent Notes

Displaying notes 61 - 70
Created by Fang on December 09, 2011 11:50:28    Last update: December 09, 2011 11:51:34
Values of Maven properties are accessed with the construct ${...} . Properties come from 5 different sources: From the environment, for example: ${env.PATH} , ${env.JAVA_HOME} . From the POM, in the form of ${project.x} . For example: ${project.version} , ${project.groupId} . From settings.xml , in the form of ${settings.x} . For example: ${settings.offline} , ${settings.interactiveMode} . From Java system properties, for example: ${java.home} . Defined within the properties element in the POM. For example ( gae.version ): <properties> <gae.version>1.4.2</gae.ve...
Created by voodoo on December 08, 2011 14:32:06    Last update: December 08, 2011 14:32:06
Use the read command to pause a shell script and give the user a chance to stop it: #!/bin/sh echo "Press CTRL-C to stop this scrip...
Created by voodoo on December 08, 2011 08:52:40    Last update: December 08, 2011 08:52:40
I don't know if there's a fool proof way to find out which Linux distro you are running on, but here are some ways you can try: cat /proc/version cat /etc/issue cat /etc/*release lsb_release -a Results on Ubuntu 11.10 oneiric: $ cat /proc/version Linux version 3.0.0-13-gene... Results on Red Hat Enterprise Server: $ cat /proc/version Linux version 2.6.18-128.1....
Created by Dr. Xi on December 07, 2011 13:51:13    Last update: December 07, 2011 13:51:13
To list all changed files under the current directory: $ svn st To list all changed files since revision 732: $ svn diff -r 732:HEAD --summarize To list all changed files since Dec 07, 2011: $ svn diff -r {'2011-12-07'}:HEAD --summarize To list all files changed after Dec 07, 2011 4:00pm: $ svn diff -r {'2011-12-07 16:00:00'}:HEAD --summa... To list all files changed since Dec 07, 2011 under the directory src : $ svn diff src -r {'2011-12-07'}:HEAD --summarize
Created by Dr. Xi on December 07, 2011 13:41:15    Last update: December 07, 2011 13:41:15
To view change history of the current directory: $ svn log To view change history of README.txt : $ svn log some/path/README.txt To view change history of README.txt since revision 733: $ svn log README.txt -r 733:HEAD To view change history of README.txt since revision Dec 07, 2011: $ svn log README.txt -r {'2011-12-07'}:HEAD
Created by Fang on November 21, 2011 16:30:56    Last update: December 07, 2011 08:54:32
This is a series of notes on building custom JSF 2.0 facelet taglibs, ordered from the simplest to the less simple. Hopefully it can help you to get started on how to build custom taglibs for JSF. A simple JSF facelets taglib example The simplest taglib I can think of. Using EL expression with a custom tag Make tag attributes dynamic. Mixing custom tag with facelet ui taglibs Discover things you might run into when you get into more details. Which EL context to use? Using the wrong EL context can lead to subtle bugs. JSF facelet taglib backed by a UI component A UIComponent can be a tag handler, without being TagHandler . Using tag handler, UI component and renderer with a JSF facelet...
Created by Fang on December 06, 2011 19:03:25    Last update: December 07, 2011 08:54:11
Our custom tag, as implemented in the previous note , is broken when a template is used. Create a template file ( home-template.xhtml ): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric... and a test page that uses it ( home.xhtml ): <?xml version="1.0" encoding="UTF-8"?> <ui:comp... Then request the page with URL: http://localhost:8080/facelet-demo/home.jsf?name=Jack . You'll find that our hello tag works inside ui:repeat but fails to get the value defined by ui:param ! What's the problem? Our hello tag implementation evaluated the EL with the wrong EL context! This is the corrected implementation: package com.example; import java.io.IOExcep...
Created by Fang on December 06, 2011 19:52:15    Last update: December 06, 2011 19:52:15
Resource files under the src/main/resources directory are copied verbatim to the target/classes directory during build. But resources can be filtered by turning on filtering in pom.xml : <build> <resources> <resource> ... When filtering is turned on, constructs like ${...} are replaced with actual values if they are defined. For example, create a file test.properties : project.stage=${project.stage} The build command " mvn package " simply copies test.properties to target/classes/ . But if you build with: mvn -Dproject.stage=dev package the contents of target/classes/test.properties becomes: project.stage=dev Sometimes you want different resource definitions for different environments, e.g., dev vs. prod. You can achieve that by defining profiles in pom.xml : <profiles> <profile> <id>dev</id> ... In the above, dev is the default profile, prod is defined but not active unless...
Created by Fang on December 06, 2011 12:36:31    Last update: December 06, 2011 12:37:23
I need Maven to generate web.xml based on the target environment. For example: <context-param> <param-name>javax.faces.P... should be translated to <context-param> <param-name>javax.faces.P... for the dev environment, and to <context-param> <param-name>javax.faces.P... in the prod environment. This is the relevant pom.xml section using resources filter: <build> <resources> <resource> <d... With the webResources filter: <build> <plugins> <plugin> <group...
Created by Fang on December 05, 2011 14:56:47    Last update: December 05, 2011 14:57:09
This works for Tomcat. It may or may not work for other servlet containers. As far as I know it's not in the standards spec. In web.xml: <context-param> <param-name>env</param-name> ... If you start Tomcat without defining env , then #{initParam['env']} is ${env} . If you start Tomcat with -Denv=dev in JAVA_OPTS , then #{initParam['env']} is dev
Previous  2 3 4 5 6 7 8 9 10 11 Next