Recent Notes
Displaying keyword search results 1 - 12
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 mee2 on October 19, 2011 20:51:04
Last update: October 19, 2011 20:51:53
From Alfresco wiki :
Script Files
Script files can be stored either on the ClassPath (for example, in alfresco/extension/myscripts ) or in a repository store. Scripts are generally stored in the default repository in the Company Home/Data Dictionary/Scripts location. Scripts in this location can be accessed directly by users via the Execute a script action . Scripts in any repository location can be accessed by any user via REST URL if they have the appropriate read permissions on the script document. Scripts on the ClassPath can be imported into other scripts but not executed directly in the web client.
Created by freyo on June 30, 2011 12:36:26
Last update: July 01, 2011 09:43:54
Code
public void install(View view) {
String url = ...
Screenshots:
Logcat:
D/InstallApp( 338): install: file:///sdcard/GetAp...
Using http://... as the URI for the APK does not work. Android fails to find a handler for the intent (logcat):
No Activity found to handle Intent { act=android.i...
Therefore, download the APK to sdcard then fire the Intent.
Created by Dr. Xi on November 23, 2010 20:20:01
Last update: March 01, 2011 13:38:51
I tried to find a GZIP compression servlet filter to compress a large log file that we send down to the browser. Most of the implementations I found were overly complicated and many buggy. This is a simple implementation that worked for me. The filter:
package filter.demo; import java.io.*; i... Config web.xml : <filter> <filter-name>gzipFilter</filte... The ugly anonymous inner class could have been avoided if the servlet API did not insist on ServletResponse.getOutputStream returning the bogus ServletOutputStream class (instead of the plain OutputStream ). Additional Note: In an earlier version of this filter, the gzip headers were added in doFilter , like this: // This is NOT good! if (supportsGzip) { ... It turned out that the ServletResponse methods sendError bypasses the gzip...
Created by Fang on August 17, 2010 21:08:13
Last update: August 17, 2010 21:08:13
JSTL string manipulation functions
String manipulation functions are simple and self-evident. You just need to know that they exist.
Test it
Make these additions to the expanded test application :
Create a new Java class StringManipulation :
package jstl.demo.handler;
import java....
Create a new JSP ( stringmanipulation.jsp ) under webapp :
<%@ taglib uri="http://java.sun.com/jsp/jstl/c...
Compile and package the WAR with: mvn package
Deploy the WAR to a servlet container of your choice (for example, Tomcat or JBoss).
Test the page with this URL (Tomcat/JBoss running on port 8080):
http://localhost:8080/jstl-demo/demo/StringManipulation
You may adjust the URL if your servlet container runs on a different port or the web app is bound to a different context root.
Created by voodoo on April 01, 2010 04:28:04
Last update: April 01, 2010 04:37:32
You were tempted by "my fun cards" and installed "my web search" on your computer. Although some people say "my web search" is harmless, but still it behaved scary. So you want to uninstall it. You click the "Add/Remove Programs" and removed the "my web search" toolbar. But then when you type in things in the Firefox address bar you find that it still brings up "my web search"! Here's how to get rid of it: Enter "about:config" in the address bar (and promise that you'll be careful). Enter "myweb" in the filter box Reset browser.search.selectedEngine and keyword.URL , extensions.mywebsearch.openSearchURL , extensions.mywebsearch.prevKwdEnabled , and extensions.mywebsearch.prevKwdURL . The extensions.mywebsearch.* settings will be removed after Firefox restart. The parameter that affects the address bar search is keyword.URL...
Created by Fang on September 19, 2009 21:16:52
Last update: March 02, 2010 05:13:04
Before you can build a Java EE project with Maven, you need to add the Java EE dependencies. And you need to tell Maven where to find the repositories for the Java EE artifacts.
For JDK 5 & Java EE 5:
~/.m2/settings.xml :
<?xml version="1.0" encoding="UTF-8"?>
<setting...
pom.xml :
<dependencies>
<dependency>
<group...
For JDK 6 & Java EE 6:
~/.m2/settings.xml :
<?xml version="1.0" encoding="UTF-8"?>
<setting...
pom.xml :
<dependencies>
<dependency>
<group...
Created by Dr. Xi on February 13, 2010 22:52:18
Last update: February 13, 2010 22:52:18
This runtime error happens when the Sun EL implementation is not available. Look for the class com.sun.el.ExpressionFactoryImpl in your deployment package, you probably won't find it, or you'll find a version that can't be loaded in your deployment environment.
If you are using Maven to build, you can add the following repository and dependency in pom.xml :
<!-- Project dependencies -->
<dependencies...
Created by Dr. Xi on September 02, 2008 18:55:18
Last update: January 18, 2010 22:36:24
Remember the times when you googled for solutions to your technical problems? How much time did you spend on wading through the zillions of links to find the ones that are of interest to you? Wouldn't you hope that you can find the answer right away the second time around? How many times were you forced to peruse hundreds of pages of documentation for a very specific need? Did you ever need to experiment with various alternatives because the documentation was vague? Wouldn't you prefer that a shortcut is available when the same thing is needed again? Xinotes is here to record your technical findings so that you won't have to go through the same process again when the problem reappears. Experience has taught us...
Created by Dr. Xi on October 14, 2008 23:02:29
Last update: October 14, 2008 23:03:50
Wrap JWhich in a servlet:
Implement the servlet:
package com.example;
import java.io.*;
...
Add this to web.xml :
<servlet>
<servlet-name>jwhich</servlet...
Request the path for a class or properties file:
http://mydomain.com/jwhich/com.example.SomeCla...
Created by Dr. Xi on September 25, 2008 02:58:27
Last update: October 14, 2008 22:49:32
This following code came from a JavaWorld tip, with some minor modifications.
public class JWhich {
/**
* Retu...
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
...