background preloader

Jsf - primefaces

Facebook Twitter

Jsf - commandLink/commandButton/ajax backing bean action/listener method not invoked. The BalusC Code: The benefits and pitfalls of @ViewScoped. Introduction To prepare for a new set of JSF 2.0 targeted articles (have patience, I'd like to wait for Eclipse Helios and Tomcat 7 to be finished), I've played intensively with JSF 2.0 and Facelets the last weeks (to be precise, with Mojarra 2.0.2).

The BalusC Code: The benefits and pitfalls of @ViewScoped

The new JSF 2.0 annotations and implicit navigation (the outcome will implicitly go to /outcomevalue.xhtml page) are great and very useful. No hassling with faces-config.xml anymore. It's awesome. JSF 2.0 also introduces an important new scope and offers the possibility to define your own custom scopes. Package com.example; import java.io.Serializable; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; @ManagedBean@ViewScopedpublic class Bean implements Serializable { // ... } Note that the bean needs to implement Serializable as it will be stored in the view map which is in turn stored in the session. The new view scope should solve exactly those issues. Back to top Really simple CRUD Amazingly simple, isn't it? JSF Best Practices: Scope management for clean sessions. Scope management for clean sessions Abstract When starting with JSF one of the common pitfalls is how to pass values or parameters efficiently.

JSF Best Practices: Scope management for clean sessions

In many cases developers end up putting Managed Beans in Session Scope to share Bean attributes though more appropriate solutions are available. This article lists some routine tasks for JSF developers and gives tips and tricks on how to pass values efficiently without having to pollute the session-object. The intended audience for this article are novice JSF developers as well as developers that are interested in alternative solutions to common problems. Session pollution and why it is hazardous Admittedly, putting all your Managed Beans in Session Scope may be a working solution for some problems encountered while developing web applications with JSF. There are a few simple questions to consider when dealing with Session Scope: Is the instantiated object required available throughout the entire user session? Passing information to handlers ... Making Distinctions Between Different Kinds of JSF Managed-Beans. JSF has a simple Inversion-of-Control (IoC) container called the JSF Managed Bean Facility (MBF).

Making Distinctions Between Different Kinds of JSF Managed-Beans

Although it has a verbose XML syntax, and is not as robust as the Spring BeanFactory, PicoContainer, or the JBoss Microcontainer, the MBF does have the basics of an IoC container, and offers features like dependency injection. When a POJO is managed by the JSF MBF, it is typically referred to as a managed-bean. But if you're going to create a maintainable JSF webapp/portlet, it is necessary to distinguish between different kinds of managed-beans. This practice will also preserve the clean separation of concerns that JSF provides by implementing the Model-View-Controller (MVC) design pattern: Now... » Primefaces Selective Components – Checkbox, Button, Radio Button TutorialJournalDev. Primefaces library has provided different forms of components that make use selective function.

» Primefaces Selective Components – Checkbox, Button, Radio Button TutorialJournalDev

As such, this tutorial will cover all of required information that’s relevant for each type of them. Following list of Selective components that you’re going to learn. Just click on your preferred component to navigate into. We’ve intended to mention the basic usage of Primefaces’ selective components features at this tutorial. Several selective components provide a common behaviors that are implemented equally among all them. Let’s explore these components thoroughly and see how can we leverage them into your application. SelectBooleanButton Basic Info SelectBooleanButton is used to select a binary decision with a toggle button. SelectBooleanButton Attributes Getting Started With SelectBooleanButton SelectBooleanCheckbox Basic Info SelectBooleanCheckbox is an extended version of the standard checkbox with theme integration.

SelectBooleanCheckbox Attributes Getting Started With SelectBooleanCheckbox. Jsf - commandLink/commandButton/ajax backing bean action/listener method not invoked. JSF/ICEFaces Checkbox Converter Issue. Environment: ICEFaces 1.6.2, MyEclipse 6.0.1, Liferay portal server on JBoss Symptoms: SelectBooleanCheckbox with a custom converter is throwing java.lang.IllegalArgumentException: argument type mismatch exception.

JSF/ICEFaces Checkbox Converter Issue

After some debugging you discover its not calling getAsObject() at all, and is apparently trying to stick a Boolean into your underlying value-binding. Set Up: The underlying binding is not a boolean (or Boolean) , but a variable of some other data type you want to have represented as a checkbox on the screen (could be a String, or a Byte as in my case). You wrote a custom converter to convert back and forth between your value and boolean, so that getAsString() returns either true or false, and getAsObject() returns an object of your data type. Why its not working: The first Sun forum post referenced below has some justification which basically says that checkbox value is Boolean while converters are meant to be used for components that display String values.

References: JSF/ICEFaces Checkbox Converter Issue.