Interactive book list

Its not really ready, the interactive book list containing my reviews. Anyhow, I decided to go online with a kind of preview: Developed as JSF-Application using NetBeans, I’ll report about the internals. The first of this series was my last article about a simplified language switcher. More will follow.

JSF: Quick way to switch language

If you search the web, you’ll find a couple of solutions to change the language of your web application. I like to contribute an other one, which might be the shortest 😉

Suppose, you want to display all supported languages in their native tongue.  Thus, you need no translation for the language names. The language codes are simply passed as parameter to your action.

Here is what you need in your JSF page (feel free to replace commandBotton by commandLink or something else):

<h:commandButton action="#{tool.changeLang('de')}" immediate="true" value="Deutsch"/>
<h:commandButton action="#{tool.changeLang('en')}" immediate="true" value="English"/>
<h:commandButton action="#{tool.changeLang('fr')}" immediate="true" value="Français"/>

And in you need this short method:

public String changeLang(String langCode) {
    FacesContext.getCurrentInstance().getViewRoot().setLocale(new Locale (langCode));
    return null;

That’s all.


To web development content.

Tutorial web development (with JSF): Application “BookReview”, Part I

In my blog, I publish a list of those books, I wrote a review for. Every book will be displayed in a table with this information:

  • Title
  • Subtitle
  • Author(s)
  • Publisher
  • Year
  • Language
  • ISBN
  • Short text
  • Reference to my rewiew

These information is written manually and has to be maintained for every category and language. Changing the layout (if more than just CSS) will be a huge effort.

Now, I want to develop a multiligual application for publishing my booklist in an easy manner. One goal is to publish this information from a single soure in diverse categories and / or languages. Every book should be listet in the appropriate category just by assigning this category. The layout may change and should be maintained at a central place to be used for all books.
Continue reading “Tutorial web development (with JSF): Application “BookReview”, Part I”

JSF, mark required fields

Don’t you know this: You have an application using some dialogs and each dialog contains some required fields and some, whiche are not mandatory. To disinguish these two kinds of fields, the required fields should be marked, e.g. with an asterisk. Now, what we want to do, is to write a central function which might be used in all pages. The idea is quite simple: Before rendereing, check all labels and theis associated input components. If the input is required, mark it. Continue reading “JSF, mark required fields”