Object conversion is a common requirement in JSF. Surprisingly there is no template for a JSF Converter in the NetBeans Template list. I have created a template to create JSF Converters in NetBeans.
To use the template is very simple:
- Download the template.
- Start NetBeans.
- Go to Tools --> Templates.
- Select the JavaServer Faces folder.
- Select Add from the menu.
- Locate the file you downloaded and select it, and you are done.
Here is the file: Converter.zip
<#assign licenseFirst = "/*"> <#assign licensePrefix = " * "> <#assign licenseLast = " */"> <#include "../Licenses/license-${project.license}.txt"> <#if package?? && package !=""> package ${package}; </#if> import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; /** * * @author ${user} */ public class ${name} implements Converter{ public Object getAsObject(FacesContext facesContext, UIComponent component, String value) { throw new UnsupportedOperationException("Not supported yet."); } public String getAsString(FacesContext facesContext, UIComponent component, Object value) { throw new UnsupportedOperationException("Not supported yet."); } }
0 comments :
Post a Comment