-
In the first part of this article, I began briefing you on optimizations I made to maximize the responsiveness of a JSF application that I developed out in the field. I cited performance problems caused by casually accessing components from a JSF view, then presented a set of best practices to eliminate this unnecessary overhead. Despite the progress made by the end of the first part, you had not yet witnessed the two orders of magnitude in performance improvement that was promised.
-
JavaServer Faces (JSF) has a reputation for having poor performance. Some claim that this "runtime tax" is simply the cost of using a component-based abstraction layer. After focused research, I have determined that by following a handful of best practices, you can get your JSF data tables to perform almost as well as hand-crafted HTML while still being able to retain the benefits of developing with an event-driven programming model. I begin by identifying some performance problems that occur when using JSF UI components, Seam components, and the EL carelessly, and then present, through a series of four lessons, ways to eliminate these problems one-by-one until you have observed a remarkable, two orders of magnitude improvement.
-
How would you implement a Plugin-system for your Java application?
Is it possible to have an easy to use (for the developer) system which achieves the following:
Users put their plugins into a subdirectory of the app
The Plugin can provide a configuration screen
If you use a framework, is the license compatible with commercial developement? -
So we know that all injected properties of a component are dynamically injected prior to business method execution. This means every time a business method is invoked whether or not those properties need to be re-freshed all of the properties marked @In are re-fresh/re-injected. So let's take a hypothetical case. Say we have 20 Seam components that need to be injected into component Foo. Would it not be more efficient to use Component.getInstance(C1.class) instead of the unnecessarily repetitive and time-consuming "swarm" of dynamic injections? For a particular business method, you get the component you need at that exact time. Instead of getting all 20 of them when you may only need one of them for that particular business method. That's overkill. Use @In except when absolutely necessary like injecting SMPC and Log instance via @Logger.
links for 2011-09-21
22 09 2011Comentarios : Deja un Comentario »
Categorías : delicious
links for 2011-09-16
17 09 2011-
In this two-part tutorial you will learn how to get started with the development of Seam applications with RichFaces using Eclipse with JBoss Tools. In the 1st part we've set up our environment, created, and run an empty shell Seam application. In this 2nd part we will create a simple web page with a table presenting data on multiple pages using Ajax (a RichFaces component) and its model stored as a POJO Component in the Seam Conversation scope. I assume that you already have some basic knowledge of Seam and JSF, for instance that you know what a Component or the Conversation scope are. I'll present my path to this goal with all the mistakes so that you too can learn from them.
My aim in this tutorial series is to create a Seam portlet displaying data in a paged (and ideally also sortable and filterable, but lets be realistic) table running in the Liferay portal.
Comentarios : Deja un Comentario »
Categorías : delicious
links for 2011-09-15
16 09 2011-
If you are building a web application with a user-interface for editing dates that supports time zones, then you are going to need a list of time zones. You need this if you want to edit or display times in 'local time' and store them as UTC (universal time). This article shows the Java code and a handy Seam component that provides the list.
-
The correct solution is to allow the time zone to be set per JSF application, configured in faces-config.xml. In fact, there is already an ideal place to put this configuration: within the <locale-config> element, complementing the default locale. The developer would specify a time zone ID in the <default-time-zone-id> element and JSF would resolve a TimeZone object from this ID. Here's an example showing the default time zone set to New York.
-
The <rich:calendar> component provides the possibility to use internationalization method to redefine and localize the labels. You could use application resource bundle and define RICH_CALENDAR_APPLY_LABEL, RICH_CALENDAR_TODAY_LABEL, RICH_CALENDAR_CLOSE_LABEL, RICH_CALENDAR_OK_LABEL, RICH_CALENDAR_CLEAN_LABEL, RICH_CALENDAR_CANCEL_LABEL there.
You could also pack org.richfaces.renderkit.calendar resource bundle with your JARs defining the same properties.
-
Some features of the Java language simply cannot be ignored. Consider for example interfaces, used extensively by every Java specification; or try/catch blocks, that form the basis for exception handling. Other features are more obscure – useful, but ignored by the masses. Without looking as far as volatile (probably the most obscure Java keyword), think about final. When was the last time you used final in your code?
Me, I'm a final fan. Enamored with final, I'm of the school of thought that inserts final any where, any time. Or almost. But why? In this article I shine the spotlight on the Java keyword final, and invite you to discover its subtle meanings, and the many Java idioms that make use of it. All for better code!
-
Mediator Pattern: Reducing Page Dependencies in JSF
-
Don't access the database in a method that feeds a UIData component! (e.g. <h:dataTable>) I see this mistake being made all the time. It's bad advice and just plain bad practice. Don't do it! The correct way to do this would be to bind the list to a context variable using a Seam factory component so that the list of users is populated exactly once per page, regardless of how many times the variable is resolved. Note that we are scrapping the managed bean definition and using a Seam component instead. The choice of page scope for the users variable ensures that the list is not refetched on a JSF postback either.
-
How and When To Deprecate APIs
Comentarios : Deja un Comentario »
Categorías : delicious
links for 2011-09-13
14 09 2011-
$ split -b 1394786 big.log
$ ls -1 x*
xaa
xab
…
xewSplit creates its output files in decreasing alphabetic order. Thus when you list them in the shell they are in the order in which
they were split. As such, you can simply use cat to merge the files. (Thanks to Paul and Davidov for pointing out my for loop was superfluous.)$ cat x* >merged.big.log
$ ls -l *.log
-rw-rw-r– 1 brock brock 175743061 Oct 12 22:08 big.log
-rw-rw-r– 1 brock brock 175743061 Oct 12 01:11 merged.big.log
$ diff merged.big.log big.log
$ md5sum *.log
47de08911534957c1768968743468307 big.log
47de08911534957c1768968743468307 merged.big.log(cat works for files created with hjsplit, too)
Comentarios : Deja un Comentario »
Categorías : delicious
links for 2011-09-09
9 09 2011-
Seam Framework – Creating Custom EL Functions
Comentarios : Deja un Comentario »
Categorías : delicious








Comentarios recientes