Skip to main content

Blog Archive for mriem during November 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>      ...
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...
Sometimes you need to write a custom converter to converter the client side representation to an object instance and vice versa. What is need to use a custom converter? See below. A custom converter package customconverter;import javax.faces.component.UIComponent;import javax.faces.context.FacesContext;import javax.faces.convert.Converter;import javax.faces.convert.FacesConverter;@FacesConverter(...
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' ?><!...
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>        ...
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/...
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...
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 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 {...
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"   ...