This post is to show how to use jQuery star rating in JSF2.
for native JSF2 implementation, please perform Adding jQuery capabilities into JSF2.
for Richfaces, make sure jQuery is working by verify jQuery in Richfaces 4 is working
Required software:
1. jQuery star rating plugin
Pre-requisite
1. JSF2/Richfaces application properly setup
2. jQuery plugin working properly in Richfaces 4
Steps:
1. put all the content of star rating into resources folder
2. invoking star rating with the following codes in xhtml
3. capture the value in JSF managedBean
4. If this is a portlet application, replace the HttpServletRequest with HttpPortletRequest.
you may also take a look on Setting jQuery Star Rating value when loading a page
and you might also interesting on How to install jQuery plugin in Richfaces 4
Done!!
for native JSF2 implementation, please perform Adding jQuery capabilities into JSF2.
for Richfaces, make sure jQuery is working by verify jQuery in Richfaces 4 is working
Required software:
1. jQuery star rating plugin
Pre-requisite
1. JSF2/Richfaces application properly setup
2. jQuery plugin working properly in Richfaces 4
Steps:
1. put all the content of star rating into resources folder
2. invoking star rating with the following codes in xhtml
3. capture the value in JSF managedBean
4. If this is a portlet application, replace the HttpServletRequest with HttpPortletRequest.
you may also take a look on Setting jQuery Star Rating value when loading a page
and you might also interesting on How to install jQuery plugin in Richfaces 4
Done!!
This comment has been removed by the author.
ReplyDeletecan i see the content of your bean class?
ReplyDeleteYou may take a look on http://kianworknotes.blogspot.com/2012/12/setting-jquery-star-rating-value-when.html, if you still have queries, please let me know.
DeleteThanks
Thanks for the reply Kian.
DeleteIm working in Seam + JSF Portlet for drug discoveries project.
Sorry for bothering you with questions
I want to know where did you put this business logic code:
FacesContext context = FacesContext.getCurrentInstance();
String star1 = ((HttpServletREquest)context.getExternalContext().
getRequest()).getParameter("star1");
In my case,all the business logic I did in 1 action class.So,do I need to put the above code in my action class?
I also want to ask whether can I use my existing Bean class which includes rating field inside it.
Thanks in avance.
Yes, the above codes i put in a method of my managedBean class.
Deleteeg,
public void retrieveRatingValue() {
FacesContext context = FacesContext.getCurrentInstance();
String star1 =
((HttpServletREquest)context.getExternalContext().
getRequest()).getParameter("star1");
................
................
}
It can be put inside any method of your managedBean.
This comment has been removed by the author.
ReplyDelete