Beiträge getagged mit facelets
Developing lightweight Java web applications – Part 5: Templating with Facelets
Verfasst von Hendrik Busch unter Entwicklung am 8. August 2008
Turning the app into a webapp
After creating a small persistence layer for our JPokerStats application, it is now time to finally create a web application out of our sources. If you already have the source files from the previous parts, you may have noticed the src/main/webapp directory that was created by the Maven archetype plugin. Let’s start here.
Getting the sources
As always, you can either go the project website or checkout the associated tag from the source control system:
svn checkout http://jpokerstats.googlecode.com/svn/tags/tutorial_part_05
Integrating Faces and Facelets
A web.xml is already present, and for a JSF application we will need to declare the JSF servlet here. We will also add some additional configuration options for debugging purposes and will map all requests to the /faces/ context to the servlet. This results in the following basic web.xml:
Developing lightweight Java web applications – Part 4: Testing the persistence using Spring
Verfasst von Hendrik Busch unter Entwicklung, Java am 28. Februar 2008
Now that all persistence classes are ready, we are going to see if they work the way we want. As we are going to use Spring in the web application, we can also use it for the tests as well, because the Spring IoC container is suitable for standalone applications and provides easy to configure testing facilities.
(Some people have asked me to use the more… function in these articles, so I will try that here.)
Getting the sources
As always, you can either go the project website or checkout the associated tag from the source control system:
svn checkout http://jpokerstats.googlecode.com/svn/tags/tutorial_part_04
Changes that became necessary
While writing this part of the tutorial, I had to change some of the classes to work the way I wanted. The most important change is switching the temporal type startTime and endTime in the Game class from TemporalType.TIME to TemporalType.TIMESTAMP. The reason behind this is the fact, that times saved to the database and loaded again are no longer equal (in terms of equals()) to the times before the save. The times contained are identical, but something else isn’t, so I had to switch as timestamps compare correctly.
As I am also learning while writing this, it may happen from time to time that I need to revise the code from a previous part of the tutorial. I will inform you of these changes as I do now.
Configuring Spring
We need a configuration file to configure Spring persistence, so we’ll create one for testing purposes. Don’t be discouraged by all the declarations in there, I’m going to explain them later on.
Developing lightweight Java web applications – Part 3: Persistence
Verfasst von Hendrik Busch unter Entwicklung, Java am 26. Februar 2008
In the last part of the tutorial, we spent some time with the basic setup of the project and wrote our first classes that we’re going to use as JPA entities. You might recall the simple entity/relationship diagram from the last part that showed how these classes, that JPA will map to database tables for us, are related to each other. Let’s recap:
- A game can have many results
- A result belongs to exactly one game and to exactly one player
- A player can have many results
Developing lightweight Java web applications – Part 2: Getting started
Verfasst von Hendrik Busch unter Entwicklung, Java am 8. Februar 2008
Welcome to part two of my tutorial for developing lightweight Java web applications! I meanwhile created an online code repository for the source files yo that you may refer to them more easily. You can either visit the project site or you can checkout the source files representing this part of the tutorial by using Subversion and calling the following command:
-
svn checkout http://jpokerstats.googlecode.com/svn/tags/tutorial_part_02
I have always been the hands-on guy, and I've always disliked documentations and tutorials that explain aspect of something without a surrounding context So in this tutorial, I'm going to explain the aspects of lightweight Java web applications by using a complete example application that actually does something.
Developing lightweight Java web applications with JSF, Facelets, JPA, Spring and Shale – Part 1: The Primer
Verfasst von Hendrik Busch unter Entwicklung, Java am 31. Januar 2008
What is this all about? (Motivation)
If you've ever dug deeper into developing web applications with JSF or have developed Java web applications in the past using other frameworks and libraries, e.g. Turbine, Velocity, Struts, etc., you will soon find that JSF itself has a a nice concept but provides only the most basic functionality.
In JSF itself you have a strict seperation of concerns and a nicely split MVC architecture, but for a fully fledged application that uses persistent data, pluggable components and a templating system, JSF on its own just isn't enough.
You could now start creating a new Java 5 EE application, building several components (JPA, EJB, etc.), bundle them into an EAR file and deploy them to the Glassfish application server. But we won't. Don't misunderstand me: there's nothing wrong with writing a full Java Enterprise application and I salute to those who do, but for most developers such a setup is just overkill (whereas a simple Servlet is not enough). But this series is about lightweight applications. Please note that "weightâ?? is not measured in bytes but in the amount of stuff you have to write to get things done.
This series describes a different approach to Java web applications and is inspired by the facesgoodies project developed by Matthias Wessendorf. This project is a kickstart project for developing JSF applications including Spring and Shale using the JPA persistence layer. Unfortunately it is not document very well and somewhat hard to understand for those who have never used Spring or configured a more complex web application or a persistence unit.
This series/tutorial is designed to help you design next generation web applications using modern, community supported technologies.








