The NetBeans project is located here: interfaces.zip
Pages
▼
Monday, April 16, 2012
Public, Protected, and Private Interfaces... Yes Interfaces.
One of the junior developers came to me on Friday and asked if an interface could be private, or protected. I said sure, but it must be an inner interface. The interface must be contained within a containing class. So I decided to create a couple of examples of interface fun for you to appreciate.
The NetBeans project is located here: interfaces.zip
The NetBeans project is located here: interfaces.zip
JSF 2 on JBoss AS 5.1.0
I was confronted with a requirement to run JSF 2 on JBoss Application Server 5.1.0 on Friday. As you may know, JSF 2.0 will run on Java EE 5 application servers, but not with all the bells and whistles that we have come to expect with Java EE 6.
Requirements
Instructions
- Install JBoss Application Server.
- Make sure that the server is not running.
- Go to the <jboss_home>/server/default/deploy/jbossweb.sar/jsf-libsdirectory.
- move the jsf-api.jar and jsf-impl.jar to a safe location. We will be replacing it with the javax.faces.jar from the JSF 2.0.9.zip distribution.
Note: the javax.faces and com.sun.faces files are combined in one jar now. The Mojarra Reference Implementation is in a single jar now. - Go to the <jboss_home>/server/default/deployers/jbossweb.deployer directory.
- Open the web.xml in a text editor and comment out the following lines:
- Start the application server and check the logs. You should see something like the following:
14:23:30,058 INFO [TomcatDeployment] deploy, ctxPath=/admin-console
14:23:30,257 INFO [config] Initializing Mojarra 2.0.9 (SNAPSHOT 20120202) for context '/admin-console'
14:23:45,013 INFO [application] JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans
methods marked with these annotations will have said annotations processed.
Summary
You should be able to install and use JSF 2 with Java EE 5 Application servers like JBoss AS 5.1.0 without issues by simply updating the required JSF libraries.Monday, April 02, 2012
JSF 2.0 JQuery-JSF Integration
I am publishing an example of how to use jQuery with JSF. This is a basic jQuery Dialog which is integrated into a JSF 2.0 Reference Implementation (Mojarra) page.
There are a couple of JSF frameworks which take extensive use of jQuery like PrimeFaces which I would highly recommend.
This is just a simple example to show you how to get started.
Here is the NetBeans Apache Maven Mercurial project: jquery-jsf-integration
There are a couple of JSF frameworks which take extensive use of jQuery like PrimeFaces which I would highly recommend.
This is just a simple example to show you how to get started.
Here is the NetBeans Apache Maven Mercurial project: jquery-jsf-integration
index.xhtml
included.xhtml
JDBC-ODBC Bridge Example
I was recently asked how to use the JDBC-ODBC bridge. I told the person asking that "normally" you would want to use JDBC, and that the Sun developed bridge is not really for production use. I was reminded that there are some old databases out there which only support ODBC connections from Windows.
I wrote a quick example of how to use it which I thought I would share. I had to think about how to do it since it has been so long since I did such a thing. There are two examples of how to connect: one example is a "standard" JDBC connection, and the other takes advantage of the DataSource abstraction.
Note: I created an ODBC connection in Windows to the database called JDBCODBC for this example to work.
Here is the NetBeans code for the project: JavaJDBCODBC.zip
I wrote a quick example of how to use it which I thought I would share. I had to think about how to do it since it has been so long since I did such a thing. There are two examples of how to connect: one example is a "standard" JDBC connection, and the other takes advantage of the DataSource abstraction.
Note: I created an ODBC connection in Windows to the database called JDBCODBC for this example to work.
Here is the NetBeans code for the project: JavaJDBCODBC.zip