Displaying keyword search results 31 - 40
Created by James on January 10, 2011 12:35:53 Last update: November 04, 2011 19:28:03
<!DOCTYPE HTML> <html> <head> <title>jQu...For the above test page, when you move the mouse through both the outer and inner areas of the mouseover/mouseout rectangle, the output is...
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 31, 2011 21:10:10 Last update: October 31, 2011 21:13:10
In this example I'll add a parameter to a facelets template. The example contains three tabs, each tab points to a different page. The tab control is shared among all pages, therefore, it is put in the template. Starting from the simple facelet example , make these additions: Create a new template WEB-INF/templates/tabs.xhtml :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric...Add a page for the about tab ( about.xhtml ):
<?xml version="1.0" encoding="UTF-8"?> <ui:comp...Add a page for the news tab ( news.xhtml ):
<?xml version="1.0" encoding="UTF-8"?> <ui:comp...Add a page for the partner tab ( partner.xhtml ):
<?xml version="1.0" encoding="UTF-8"?> <ui:comp...Build and re-deploy the application. Launch the browser and load page http://localhost:8080/facelet-demo/about.jsf . This is a screenshot:
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 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 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 Fang on October 28, 2011 14:49:53 Last update: October 28, 2011 14:52:19
Facelet templates can be nested, for example, a page can use a template which inherits from another template. To demonstrate this, let's start from the simple example and make these additions: Add a place holder for CSS style sheets in WEB-INF/templates/default.xhtml :
<h:head> <title>Facelets Template Demo</tit...Add a derivative template ( WEB-INF/templates/default-style.xhtml ) which provides CSS:
<?xml version="1.0" encoding="UTF-8"?> <ui:comp...Add a page that uses the styled template ( home-style.xhtml ):
<?xml version="1.0" encoding="UTF-8"?> <ui:comp...The only difference between this file and home.xhtml is the template being used. Compare the display of the pages home.xhtml and home-style.xhtml .
Created by Dr. Xi on September 30, 2011 15:34:47 Last update: September 30, 2011 15:34:47
A naive try would be something like this:
$ nc -l 8082 | nc remote_host 80Yes, it does forward the request from local port 8082 to remote_host:80 , but the response is dumped to stdout , not routed back to the client as expected. Using a named pipe makes it work:
$ mkfifo backpipe $ nc -l 8082 0<backpipe | nc ...Use tee to get a glimpse of the response through the pipe (I wasn't able to find a way to dump the request):
$ nc -k -l 8082 0<backpipe | nc localhost 80 | tee...The GNU netcat has a different syntax than the stock nc . It also supports different switches. To listen to port 1234:
$ netcat -l -p 1234...
Created by freyo on September 29, 2011 16:01:31 Last update: September 29, 2011 16:09:37
With standalone broadcast receiver AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?> <manifes...Java code:
package com.android.networkreceiver; import...Register listener inside Activity programmatically AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?> <manifes...Java code:
package com.android.networklistener; import...Register/unregister broadcast receiver in onResume / onPause works because the connectivity change broadcast is sticky . I intentionally used two registerReceiver calls in onResume to demonstrate this - onReceive will be called once for each registration.