Search |
||
JSF 2.0: Writing fully reusable Spinner ComponentPosted by driscoll on November 13, 2008 at 12:48 AM PST
In my previous blog postings, I talked about making the Spinner component, and then added styles via an external css file. Please review those first, if you haven't looked at them yet.
This time, we'll move the JavaScript out to a separate file, and make sure that we can execute multiple spinners in a page, like this:
Now, we'll take a look at that external JavaScript code.
As always, questions welcome - and remember, you can try these examples out in the new Glassfish v3 prelude release, if you use JSF 2.0. I'll continue to build on these examples in future blogs, but for now, I think we've taken the spinner component about as far as it can go. »
Related Topics >>
Web Applications Comments
Comments are listed in date ascending order (oldest first)
Submitted by dumbuzz on Thu, 2008-11-13 08:28.
Assume, I have two or more spinner components on page.
How JSF achieves, that script "spinner/spinner.js", will not be added two or more times in the resulting rendered output?
Submitted by driscoll on Thu, 2008-11-13 10:08.
Remember that h:outputScript tag? It's not just there because JSF enjoys decorating every portion of the page :-)
In the case of the h:outputScript tag, as well as the h:ouputStylesheet tag, the implementation keeps track of whether that tag's been called before. If it has, there's no need to output it a second time.
So you'll have one call to
script type="text/javascript" src="/basic-ezcomp/javax.faces.resource/spinner/spinner.js.jsf"
and two calls to init in the page.
The text decoration around the spinner.js file name comes from it being put in the resources directory, as with the css file.
Submitted by dumbuzz on Fri, 2008-11-14 04:33.
"the implementation keeps track of whether that tag's been called before"
Thanks for answer.
I'll try to find how this magic works in sources of jsf2.0
Submitted by rahul_maha on Sun, 2008-11-16 01:14.
Hi Good example and great work!.
I cannot see AJAX in this example? RichFaces has a very strong and mature library Ajax4Jsf, I hope all that will be harvested and still work with JSF 2.0.
Can you put some lines on Ajax examples, how Ajax4Jsf and other open source projects are being integrated or will get compatibe/interoperable in JSF 2.0
Submitted by vladperl on Mon, 2008-11-17 09:46.
What about situation when I need to change something inside the item located in h:dataTable.
h:dataTable id="visit-list" value="#{patientServiceController.visitList}" var="item">
....
h:inputText value="#{item.copayAmount}"/>
If I changed copayAmount in row of datable how to update related value on server side without refreshing whole dataTable?
Thank you
Submitted by vmunhoz on Fri, 2008-11-21 10:12.
Congrats!
Any prevision about when JSF is plain to use in production development?
|
||
|
|