JSF RIA based applications with richfaces comes with very common, mature and stable choice. Infact, richfaces is mature enough technology for implementing AJAX, rich user interfaces easily in JSF. I am sharing some of the common best practices for optimizing JSF richfaces application.
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>true</param-value>
</context-param>
This config will enforce the container to compress all the richfaces resources including images, stylesheets, javascript to be compressed before sending to client. It will make significant reduced load time.
<filter>
<filter-name>richfaces</filter-name>
<display-name>RichFaces Filter</display-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
<init-param> <param-name>forceparser</param-name>
<param-value>false</param-value>
</init-param>
</filter>
This can be minimized by setting the forceparser setting to false. In that case only AJAX responses will be ‘tidied’. In the other case all JSF responses are ‘tidied’. That is because the filter is mapped on the Faces servlet: This can be used for partial page rendering.
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>all</param-value>
</context-param>
This configuration will make sure that all style related files should be loaded at client side at once on first request when richfaces application is accessed.
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>all</param-value>
</context-param>
This JSF richfaces optimization tip will make sure that all the javascript, files & libraries assosiated with richfaces should be downloaded at client side at the time of first request from client.
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
<init-param> <param-name>enable-cache</param-name>
<param-value>true</param-value> </init-param>
</filter>
This JSF richfaces optimization tip to enable cache richfaces components at client side and boost up significant performance hit.
<context-param> <param-name>org.ajax4jsf.xmlparser.ORDER</param-name> <param-value>NEKO</param-value> </context-param> <context-param> <param-name>org.ajax4jsf.xmlparser.NEKO</param-name> <param-value>.*\..*</param-value> </context-param>
Here we say we only use the NEKO filter and it should be applied to all URLs (.)
Ajax little tricks…
- ajaxSingle = true
this attribute should be true for any ajax component whose only value is required at server time so that whole ajax request map should not be posted to server. - limitToList = ture
this attribute should be true for any ajax compoenent who will reRender only the components specified in its reRender attribute list. All other components not specified in the reRender list will no longer reRender upon request complition. - immediate = true
This trick should be used by setting extra effort. This property will submit the value and skips validation phase and set the value immediatly into backing bean.
Your positive feedback and comments are welcomed for JSF ajax optimization.
i tried using the optimization techniques mentioned in the post,but with little success. May be i might be not doing it right. This is what i have done, can u let me know if there is anything wrong with these.
1: Even after addign LoadStyle And Script strategy in the context param i see all Richfaces.js files in the repsonse i get with all the requests that go through.
2: I also tried implementing the NEKO parser mentioned but when i tried to forward the request i got an ClassNotFoundException for org/apache/xerces/xni/parser/XMLConfigurationException . What should be done in both the cases. I would be a great help if you can throw some light. Thanks
@ Jigar
For your point number 1, actually i have decided to load all styles and script at once when the first page of application is accessed, its benefit can be while navigating to other richfaces, then no newer script file or css file will be loaded because all files were loaded before. So, you have to decide based on your application requirement.
and changing the parser should not effect because they all do the same job rendering content data but with different strategy.
So, to more precisely can you please your web.xml configs, so I can think exactly ..
Seems like you are a true expert. Did ya study about the theme? hehe
Yes, recently I have been working to develop theme in Richfaces….. If you need help regarding, just let me know. I will share my experience here.
Thanks for your advices. As I run Yslow, my report states that I should also:
- use a content delivery network
- add expires headers
- compress components with gzip.
Is there an easy way to do this through Richfaces xml settings?
Hi ,
I have some problem with modal panel
i want to render a outputText field in parentwindow on button click in modalpanel
this works when i directly put the button in modalpanel,but does not work if i include the button in a page which is included in modalpanel
follwing is the code sample …
parentpage.jsp
——————–
includetest.jsp
——————
parentpage.java
———————
package com.test;
import javax.faces.event.ActionEvent;
public class parentpage {
private String outputval;
private int count;
public parentpage() {
// TODO Auto-generated constructor stub
outputval = “Before Change”;
count=0;
}
public String getOutputval() {
return outputval;
}
public void setOutputval(String outputval) {
this.outputval = outputval;
}
public void changeoutputval(ActionEvent event) {
outputval = “Got that”;
}
}
Click on “modal direct click” outputval is updated
Click On “modal included click” outputval is not updated
Please guide me in this regard..
Online marketing is not just for the effective product, producing a website or for letting customers buy items ongoing. Online marketing can also include how a business proprietor can engage a work squad. The amount of people who are studying computers, web design, and learning to host websites proves just how successful online marketing can make the employer, the employees, and the independent contractors. And with a comfortable Internet savvy team, your business profits can increase too.
(http://www NULL.affiliatecrunch NULL.com)
Hey – nice website, just looking around some blogs, seems a pretty nice platform you are using. I’m currently using WordPress for a few of my blogs but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?
Hi,
My application loads about 2000 rows in a datatable UI at once. So, inorder to improve the performance, i implemented pagination using richfaces and i have checkbox as one of the column. My problem is : one, i am not able to maintain the status of checbox value during pagination and two, even though i use pagination i am still loading all datas in the list. Can you help me in this issue? Thanks
Hi,
First of all i would like to thank you for this excellent article. I had a problem while implementing Richfaces theme using the latest jar files(3.3.2.SR1) for my JSF application. It works fine in firefox and chrome. But in Internet explorer, the components used in the pages are not rendering properly after an ajax action(Only in some cases, for eg, Problem occuring in rich faces calender, rich combobox, component is not displaying after an ajax action). Also while the application runs in the Internet Explorer, I am getting the browser script error “Object Doesnt support this property or method”. But I never get this problem in firefox or chrome. Kindly give some valuable inputs to resolve this issue.
Thanks in Advance!!
Hi,
Hope some can help, I have an extendedDataTable in a a tab (this tab is selected by default) and for some reason when the site its initialy render (tabPanel with several tabs) it will only render part of it and wont load the rest of the tabs. Now, if I ask the tab to be rerendered it works fine. but the problem is thatinitially it habngs up the rendering of the whole site.
Any tips?
Hi there,
Im having memory problems using richfaces, memory of my tomcat server is increasing ridicuously and I get my server at memory top usage. I m setting variblas for CATALINA and JAVA on server side, and using Xms and Xmx parameters to run apache, but Im getting the same problems.
I you could helpme with this, I will appreciate you…
Thanks
Does anybody know which sort of video information are supported? I keep in mind the Instinct only could dl 3gp using opera mini. I downloaded the twist ap, maybe that’s the problem? How can I watch videos from sites apart from youtube? Which file types? Usually I’m given the option of 3gp or mpeg4. Can’t get either to work. Thanks on your time! Rattling I want I used to be eligible for the upgrade to EVO!
Wonderful one, thank you for the tip
More handy of optimizing is using on fly libraries to combine JS/JSF
http://code.google.com/p/granule/ (http://code NULL.google NULL.com/p/granule/)
I’ve been absent for some time, but now I remember why I used to love this site. Thanks, I’ll try and check back more often. How often do you update your website?
I think other web site proprietors should take this website as an model – very clean and fantastic style and design, as well as the content. You’re an expert in this topic!
I’ve recently started a blog, and the information you offer on this website has helped me a lot. Thank you for all of your time & work.
I am hardly ever impressed by help and advice articles but this article just established plenty authentic and precious information that I just have to acknowledge it. I am well-aware of all the importance of this information and salute you with a sincere thanks for your insight. I just tried to bookmark your site to share but I can’t, I reckon your bookmark symbol isn’t working. Just to let you know. Carry on with posting great and unique contents. Cheers !
Howdy! Someone in my Facebook group shared this website with us so I came to give it a look. I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers! Wonderful blog and wonderful design and style.
http://www.silverbackmusic.net/index.php/member/249603/ (http://www NULL.silverbackmusic NULL.net/index NULL.php/member/249603/)
kvzplkbwbqmfy, yahoo web hosting (http://greatpreowned NULL.com/yahoo-web-hosting-coupon-codes/), XHgfvQM, [url=http://greatpreowned.com/yahoo-web-hosting-coupon-codes/]yahoo web hosting coupon[/url], roJqnZH, http://greatpreowned.com/yahoo-web-hosting-coupon-codes/ (http://greatpreowned NULL.com/yahoo-web-hosting-coupon-codes/) yahoo web hosting, CwvhGBt.
xzasfkbwbqmfy, Mature porn (http://chiefbodega NULL.com/), CqIIMGD, [url=http://chiefbodega.com/]Gold mature porn[/url], lmOPRNW, http://chiefbodega.com/ (http://chiefbodega NULL.com/) Hamster mature porn, BYyAkmC.
kbwbqmfy (http://pornsks4all NULL.com/), oTMLkXT, [url=http://pornsks4all.com/]kbwbqmfy[/url], WwdazGE, http://pornsks4all.com/ (http://pornsks4all NULL.com/) kbwbqmfy, EOzLjic.
afpoykbwbqmfy, V2 cigs coupon code (http://tjdcompany NULL.com/v2-cigs NULL.html), XfeEFDT, [url=http://tjdcompany.com/v2-cigs.html]V2Cigs[/url], eUdnyjC, http://tjdcompany.com/v2-cigs.html (http://tjdcompany NULL.com/v2-cigs NULL.html) V2cigs review, UJNnKIZ.