Skip to main content
View by: Most Recent | Topic | Community | Webloggers   
Monthly Archives:    

Blogs by Community: Java Enterprise

• Adopt a JSR  • Embedded  • GlassFish  
• Global Education and Learning  • Identity Management  • IoT  
• Java Communications  • Java Desktop  • Java Enterprise  
• Java Patterns  • Java Tools  • Java User Groups  
• Java Web Services and XML  • JavaFX  • JCP  
• JDDAC  • Jini  • JXTA  
• Mac Java  • NetBeans  • Open JDK  
• Portlet  • Robotics  • Sun Grid  
• Sun RFID and Sensor  • [no association]  


Java Enterprise

Occasionally, users have the need to override the version of JSF included in the application server by bundling a different version of JSF with their application. If you are trying to use CDI in such a scenario, you might have noticed it does not work. Is there a way out? Yes, there is, by including a small JAR and some configuration in your web application you can make this scenario work. Add...
on Dec 10, 2013
To make it possible to debug the view tree the JSF runtime has a debug component (ui:debug) that you can use. What is the best way to do this? Add the ui:debug component to the bottom of your page and activate it only in Development mode. This makes it available when the application needs to be debugged, but it does not put a burden on a Production application.   <ui:debug rendered=...
on Dec 9, 2013
How do you convert a date in JSF? The example below outputs the date using the long date style <?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"      xmlns:h="http://java.sun.com/jsf/html"      xmlns:f="http://java.sun.com/jsf/...
on Dec 6, 2013
If you have ever wondered which version of Mojarra is running on the container you can determine what version is running using a simple piece of code. How? The following code snippet shows you how!   FacesContext.getCurrentInstance().getClass().getPackage().getImplementationVersion() And that is it. Enjoy!
on Dec 4, 2013
Hurray, 50 JSF tips! For your convenience I have prepared a JSF tips bitly bundle that links back to them all. See http://bitly.com/bundles/o_7q05ovp05f/2 And that is it. Enjoy!
on Dec 3, 2013
Ever wondered how you would use a composite component within a composite component? Or is it not possible? It most certainly is possible, so lets see how! First we define level 2 (the deepest nesting) <?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"      xmlns:h="...
on Dec 2, 2013
In the previous blog entry we touched upon packaging a custom converter. Now we'll describe what you need to do to use it. Add the maven dependency to your project.         <dependency>            <groupId>org.glassfish-samples.jsf</groupId>      ...
on Nov 27, 2013
Just like a composite component you might want to distribute a converter, but how would you package it? Easy, read the rest down below! The converter package customconverter;import javax.faces.component.UIComponent;import javax.faces.context.FacesContext;import javax.faces.convert.Converter;import javax.faces.convert.FacesConverter;@FacesConverter(value = "customConverterId")public...
on Nov 26, 2013
When you developed a composite component the namespace you would be seeing would look like "http://java.sun.com/jsf/composite/xxxxxx". But what if you are not allowed to use it that way or you just do not like it, is it possible to change that? Yes it is possible. This blog entry shows you how. The composite component <?xml version='1.0' encoding='UTF-8' ?><!...
on Nov 22, 2013
In the previous blog entry we set the stage on how to package a composite component in a JAR. Now we are going to use it! Add the dependency to the POM         <dependency>            <groupId>org.glassfish-samples.jsf</groupId>        ...
on Nov 21, 2013
If you want to share a composite component between projects you should package it in a JAR. But how would you do it? Well it is pretty easy. First include the resources in the META-INF/resources directory. E.g. <?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/...
on Nov 20, 2013
In JSF 2.2 it is has been made easier to work together with a HTML designer. The page below exposes a traditional h:inputText and a h:commandButton using a more HTML 5 friendly way of doing this. <?xml version='1.0' encoding='UTF-8'?><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"      xmlns:jsf="http...
on Nov 19, 2013
In JSF 2.2 it is possible to define flows, one of the things you would want to do is to be able enter and to exit a flow. This blog entry shows you a sample on how you can enter a flow and also how to exit it properly. The page below uses a commandButton to enter the flow "enterexit" <?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE html><...
on Nov 18, 2013
On the #jsf IRC channel Ryan asked how you can get it so the JSF runtime loads resource library contracts from the filesystem. This blog entry will show you how. BE AWARE this code is a proof of concept. To make it production ready make sure you sanitize incoming resource URLs thoroughly! The FilesystemResourceHandler public class FilesystemResourceHandler extends ResourceHandlerWrapper {...
on Nov 15, 2013
In the previous blog entry a single resource library contract was applied. However did you know that you can stack them? We are going to add the following 3 layout contracts, desktop, tablet and phone. The desktop contract <?xml version='1.0' encoding='UTF-8'?><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"   ...
on Nov 14, 2013
In JSF 2.2 you have the ability to define a resource library contract so you can deliver a different experience on the basis of which user visits your website. This blog entry shows you how you can switch between a resource library contract on the basis of an EL expression. To show this off we define 2 CSS styles, blue and red. The blue style body {    background-color: blue;} The...
on Nov 14, 2013
Creating and using a composite component is very straightforward. 1. Creating the composite component 2. Using the composite component Creating the composite component <?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><...
on Nov 12, 2013
How can you create a custom validator and use it? See below! Creating the custom validator class package customvalidator;import javax.faces.application.FacesMessage;import javax.faces.component.UIComponent;import javax.faces.context.FacesContext;import javax.faces.validator.FacesValidator;import javax.faces.validator.Validator;import javax.faces.validator.ValidatorException;@FacesValidator(value...
on Nov 11, 2013

Java Web Services and XML

I was very pleased to see the JFrog team take me up on my suggestion early this year that "Maybe the JFrog team will consider giving a presentation on how they put all this together at JavaOne this September". Unfortunately for me, the session (Building a Massively Scalable Cloud Service from the Ground Up) was already filled to capacity as I walked up to the door, so I was unable to attend....
on Dec 8, 2013

Java Desktop

SBT in Action by Joshua Suereth and Matthew Farwell has been updated! Save 45% and just enter promo code 112113jn at manning.com. What else is new? Chapter 6, "Process & IO with sbt's libraries" has been added to the MEAP (Manning Early Access Program). Chapter 6 takes a look at how sbt allows you to run external processes easily, and how to combine them in a shell-like manner. You’ll also...
on Nov 21, 2013