Recent Notes
Displaying notes 121 - 130
Created by Dr. Xi on February 12, 2010 22:52:27
Last update: November 08, 2011 19:48:09
For Tomcat 6, there's no default manager username and password. You do have to set it up yourself, though it's pretty straightforward. The Tomcat manager webapp is restricted to users with a role named manager . So you'll need to create a user and assign the manager role to it.
Edit $CATALINA_BASE/conf/tomcat-users.xml to read:
<?xml version='1.0' encoding='utf-8'?>
<!--
...
For tomcat 7:
<tomcat-users>
<role rolename="manager"/>
...
Created by Fang on November 08, 2011 14:40:57
Last update: November 08, 2011 14:40:57
This error happened when I loaded a JSF page, using Apache MyFaces. From the stack trace it looked like the XML parser failed, but in reality the runtime was not able to load the class specified in the handler-class element - a typo in the class name! That's the price you pay for wiring together components with XML!
This was the stack trace:
Caused by: org.xml.sax.SAXException: Error Handlin...
Created by Fang on November 07, 2011 09:41:57
Last update: November 07, 2011 09:42:25
Using JSTL tags in JSF facelets is quite simple: just add the XML namespace for the JSTL tags and use them in the page.
An example of using the <c:if> tag:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Trans...
Created by Fang on November 05, 2011 07:21:14
Last update: November 05, 2011 07:21:14
Generated documentation of JSF 2.1 facelet tags:
http://javaserverfaces.java.net/nonav/docs/2.1/vdldocs/facelets/index.html
Created by Fang on November 04, 2011 14:45:20
Last update: November 04, 2011 19:55:34
To get the values of web.xml context parameters:
from faces context:
facesContext
.getExternalContext()
.getInitP...
from facelets context:
faceletContext
.getFacesContext()
.getExtern...
inside a page:
#{initParam['PARAM_NAME']}
Created by James on January 10, 2011 12:35:53
Last update: November 04, 2011 19:28:03
The events mouseover and mouseout are fired when the mouse enters/leaves the element where the event handlers are registered, and any nested elements which do not handle these events (because of event bubbling ). The events mouseenter and mouseleave are fired only when the mouse enters/leaves the specified element. Nested elements do not come into play. This following is a test page. You need Firebug to view the console output. Or use the JavaScript Executor bookmarklet. If none of these are available, an alert will popup (but you won't be able to fully test with alert.).
<!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 balu on November 04, 2011 15:00:08
Last update: November 04, 2011 15:02:10
The @ operator selects an attribute from a node.
Path Expression Result
//title[@lang] Selects all the title elements that have an attribute named lang
//title[@lang='eng'] Selects all the title elements that have an attribute named lang with a value of ' eng '
/bookstore/book[@price>35.00] Selects all the book elements of the bookstore element that have a price attribute with a value greater than 35.00
Created by Fang on November 03, 2011 21:11:55
Last update: November 03, 2011 21:11:55
Facelet tag library descriptors can be specified in one of two ways:
In web.xml , as <context-param> :
<context-param>
<param-name>javax.faces...
where javax.faces.FACELETS_LIBRARIES is interpreted as a semicolon ( ; ) separated list of paths, starting with "/" (without quotes). Each entry in the list is a path relative to the web application root, and is interpreted as a facelet XML tag library descriptor.
The parameter facelets.LIBRARIES is an alias to javax.faces.FACELETS_LIBRARIES for backwards compatibility reasons.
Via auto-discovery, by placing the XML tag library descriptor within a jar on the web application classpath (for example, under the folder WEB-INF/lib ). The file should have a name suffix .taglib.xml , and be placed in the META-INF folder of the JAR file.
Created by Fang on November 03, 2011 14:56:59
Last update: November 03, 2011 14:56:59
I want to add my own file to the META-INF folder of maven generated JAR. This is how:
Create folder resources/META-INF under src/main (if it doesn't exist already).
Copy the file to resources/META-INF .
Maven package will automatically add the file to the finished JAR.
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....