23 enero 2009

Seam localized message bundles

Storing your messages in a database



Java 6 provides enhanced ResourceBundle support

Seam has great i8ln - it provides a built in locale selector which it uses to provide localized message bundles. You can load different message bundles for different pages.

Seam's built in message bundle uses properties files to define the resources - but what if you want to store your messages in a database? You might want to allow an admin to edit the properties through a web admin panel for example. Here we will cover the basic entities and wiring needed - you will probably want to add in some CRUD views for the resources.

Entities

We create two entites, first a resource bundle entity, which defines the bundle name, and the locale which it is for:

@Entity
public class ResourceBundle {

@Id @GeneratedValue
private Integer id;

private String name;

private ResourceLocale resourceLocale;

@OneToMany(mappedBy="resourceBundle")
¨¨private List resources;
}



1 comentario:

Anónimo dijo...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!