Archive | JSF RSS feed for this section

Custom Validator in JSF

July 9, 2008

1 Comment

Custom Validator in JSF This tips presents sample programs for how to write the custom validator in JSF application. There is many built-in validators available in JSF. You can learn about the predefined tags in the article Introduction to JSF Core Tags Library . If you are new to JSF please read this article Introduction [...]

email

Create simple custom Converter implementation class in JSF

July 8, 2008

0 Comments

Custom Converter Class Implementation This article explains the simple Converter class implementation. Converter class is used for converting any given input to the desired output format or with any business logic to the input values. This example also includes the PhaseListener to identify in which JSF lifecycle phase the convertion happens. JSP File (index.jsp) 1 [...]

How to implement f:phaseListener for h:commandButton?

July 8, 2008

0 Comments

Introduction This article explains with basic example on how to implement the f:phaseListener in JSF. This tag is useful for registering any particular component to the Life Cycle of the phases. This following program provides very basic example for using f:phaseListener inside h:commandButton. JSP File (index.jsp) 1 2 3 4 5 6 7 8 9 [...]

How to implement ActionListener (f:actionListener) in JSF?

July 5, 2008

0 Comments

Introduction This article explains how to implement the ActionListener class in the JSF core tag library. An ActionListener is an event handler interface for a class that can respond to user events in your JSF page. The body content of this tag must be empty. JSP File (index.jsp) 1 2 3 4 5 6 7 [...]

f:convertDateTime tag in JSF

July 4, 2008

0 Comments

Introduction f:convertDateTime is used for validating the date input. If the user enters any invlid input, it will throw the error message to the screen. Also it allows the user to specify the apttern of date format using the ‘pattern’ attribute. JSP File (index.jsp) 1 2 3 4 5 6 7 8 9 10 11 [...]

h:outputFormat tag in JSF

July 4, 2008

0 Comments

Introduction The outputFormat tag renders parameterized text and allows you to customize the appearance of this text using CSS styles. Parameterized text is compound text containing placeholder values to be replaced by actual values at rendering time. JSP File (index.jsp) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <%@page [...]

f:convertNumber Tag in JSF

July 4, 2008

0 Comments

What is the use? This tag is used to register the NumberConverter instance on the enclosing component. This class is responsible to convert String to java.util.Number object and vice-versa. JSP file 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 <%@page pageEncoding="UTF-8"%> <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%> [...]

How to initialize Map property in Managed Mean?

July 2, 2008

0 Comments

Map property in Managed Mean JSF Managed Beans can initialize its Map properties in the faces-config.xml. There is a property in the faces-config.xml as map-entries. This cane be used for initializing the values and can be accessed directly through the Managed Beans in any JSP pages. You also can directly use the List as Managed [...]

Display error messages in JSF [ h:messages ] – part 1

April 12, 2008

0 Comments

Topic : Java Server Faces (JSF) Environment : J2EE 5.0, MyFaces 1.1.5 Discuss Here errorMessage.jsp 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18   <!– Source : www.javabeat.net –>       <html> <body> <f:view> <h:form id="select"> <h:messages /> <h:inputText id="name" value="#{errorMessageBean.name}"/> <h:commandButton value="Submit" action="#{errorMessageBean.submit}"/> [...]

h:selectOneMenu – Java Server Faces (JSF)

April 12, 2008

1 Comment

Topic : Java Server Faces (JSF) Environment : J2EE 5.0, MyFaces 1.1.5 selectOneMenu.jsp 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 <html> <body> <f:view> <h:form id="select"> <h:panelGrid columns="1"> <h:column> <h:outputText value="Select a Name : "/> <h:selectOneMenu value="#{selectOneBean.name}"> <f:selectItem itemValue="SteveJobs" value="SteveJobs"/> [...]