Thursday, December 27, 2012

Setting jQuery Star Rating value when loading a page

This is an extension post for How to use jQuery star rating in JSF2
This post show how to set the Star Rating value when page loading.
It's also applicable for retrieving Star Rating value from database.

Steps:
Managed Bean
1. Declared a value holder, in session scope managedBean.
managedBean property to hold rating value

2. capture the star value and set into the value holder.
this.setStarValue(Integer.parseInt(star1));

XHTML
1. bind the value holder with the "checked" attribute of the radio button.
binding the managedBean property to the checkbox

With the above steps, the Star Rating will show previously rated value (or value stored in database).

Done!!

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...