What makes Pretty URLs in JSF so hard, and so slow?
Speed up development, reduce bandwidth, enhance user experience. This article gives a brief overview of JSF navigation, some of the problems, and potentially how to solve them by enabling bookmarkable, pretty URLs. Put simply… in my view, out of the box, JSF is a web framework designed for web-applications, not designed for web-sites.
Target audience for this article:
- The reader is familiar with JSF navigation.
- The reader is attempting to create a JSF app with bookmarkable “pretty” URLs. E.g.: …/mysite/archives/2008/11/11/
- The reader is familiar with HTTP request/response at a basic level.
Read the rest of this entry »
We’ve gotten a good number of comments from Lincoln’s latest post on Spring Security and JSF. A few comments have asked for further code samples on how to get this example working.
We created a runnable project for this example, and it can be downloaded here.
Read the rest of this entry »
Tutorials - What a nightmare
Everyone seems to be going through hell to get a fully functional JSF login page working with Spring Security (formerly Acegi,) and yes, I did too, but there’s an EASY way to make this happen. And get this:
- It takes just five clear and well written lines of Java code.
First, the solution. Afterwards, the dirty details. (Spring 2.5.2 was used for this example.)
You can find a downloadable working example here.
Read the rest of this entry »
Very Simple
In a JSF Reference Implementation, passing global faces messages between pages doesn’t work. It’s not designed that way “out of the box.” Fortunately there is a way to do this, which will even support redirects between pages, forwards through a RequestDispatcher, and also through standard JSF navigation cases.
There is a 5 minute solution to this problem.
Read the rest of this entry »
Tagged Under : Java, JSF
Tutorial - Step By Step
If you’ve learned to use JSF Facelets to create on-the-fly, simple components using XHTML, then you probably have a whole slew of custom components that need to be copied between various projects, and can be somewhat painful to keep up to date. You may have tried to move them into a jar file, but Facelets can’t find them there (without some help from us.)
*The author of this article has requested feedback on the usability of this article. Please post questions, improvements, and/or comments.
Read the rest of this entry »
A4J:Form is missing several specified ajax functions
(View this issue on the JBoss tracker here. Keep reading, there is a fix… download fix)
The issue:
When using the a4j:form component, the data=”#{managedBean.property}” the properties defined in the data element list are supposed to be available after the a4j event in the data JavaScript variable; however, with <a4j:form> the attribute is not correctly causing the JavaScript data variable to be populated.
Read the rest of this entry »
Tutorial Chapter 2 - Easier Development and Maintenance
Tired of wiring in an id, version, and timestamp field into all of your Hibernate objects? There’s an easy way to solve this pain once and for all of your classes. Avoid code-repetition: today’s article focuses on using Hibernate Annotations to map common fields into one mapped superclass.
If you have not done so already, and need to get a bare bones hibernate application up and running, this guide should get you up and running in a few minutes.
Read the rest of this entry »
Today’s subject is a well commented square root approximation method. Imagine that this method is buried deep in a very messy Java class. How can we make sure that this code is reusable and that our comments don’t become out of date as our code changes?
/**
* Approximate the square root of n, to within the specified tolerance,
* using the Newton-Raphson method. This method takes two arguments:
* @param Double n The number to be square-rooted
* @param Double tolerance the error tolerance
* @return Double result of square root operation
*/
public Double approximateSquareRoot(Double n, Double tolerance)
{
Double root = n / 2;
while (Math.abs(root - (n / root)) > tolerance)
{
root = 0.5 * (root + (n / root));
}
return root;
}
Read the rest of this entry »
Tagged Under : Java
Tutorial Chapter 1 - Step By Step
Getting started with Hibernate can be tricky, but here’s a step-by-step tutorial that explains exactly what needs to be done to enable your application for hibernate. This chapter covers very basic mapping and persistence.
Download the following archives:
Read the rest of this entry »
Is there light at the end of the tunnel?
So I’m sure I’m not alone here, when I say that Hibernate can be frustrating, difficult to learn, and may even feel like to use it means to give up on some design principles that have been proven by many.
When you first begin, it feels like there are holes, inconsistencies, and problems that send you running home to the familiar behavior of plain SQL. But, I don’t think it’s time to give up on Hibernate yet.
Keep in mind that I am a relatively new Hibernate user, I consider myself somewhat experienced with software development, design patterns, principles, and best practices. If this sounds like you, read on…
Read the rest of this entry »