Contribute to NetBeans (and other projects)

You may support open source projects by contributing comments, bug reports, wish lists or code etc.

For the current release of NetBeans, I only reported some bugs. This is a partial result of these contributions: “Contribute to NetBeans (and other projects)” weiterlesen

NetBeans 7.2 rocks

In the current iX 03.2012 you’ll find my article about new features of NetBeans 7.1. Beside lots of positive features , I mentioned one drawback: Sometimes project san during IDE startup takes a long time.

Using NetBeans 7.2, which is scheduled for 3.Q 2012, this will change: The scan is performed faster and running in background.

On the road to this release, version 7.1.1 is now available at netbeans.org.

Back to life

Ok, I not only survived a horrible breakdown. I need to be a bit patient and hopefully I’ll be fully restored. Time to talk about life cycle. Lifecycle of JSF. Not a full-fledged article yet, but a tutorial to find out by yourself. “Back to life” weiterlesen

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 Tool.java 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.

JPA and legacy database

Suppose, you have to store orders in a SQL DBMS. An order consists of header (address, date, number etc.) as well as a variable count oflines (amount, product, price, tax, …). This should be stored in two tables.

Table Order (
        orId Integer,
        [...]
)    

Table OrderLine (
        olId Integer,
        olOrderId Integer,
        [...]
)  

To prevent working directy with SQL, you use JPA. Two entity classes, which are annoted.

“JPA and legacy database” weiterlesen