previous | index | next

Passing Data from the UI to the Server

In the locale-changing example, two links are used:
     <h:commandLink action="#{localeChanger.germanAction}" immediate="true">
        <h:graphicImage value="/german_flag.gif" style="border: 0px"/>
     </h:commandLink>
     <h:commandLink action="#{localeChanger.englishAction}" immediate="true">
        <h:graphicImage value="/british_flag.gif" style="border: 0px"/>
     </h:commandLink>

Since they invoke different actions, there are different bean methods in the ChangeLocaleBean.

But suppose there were 100 languages to support—there would be much redundant code to write and maintain.

Preferable: pass the language code from the UI to the server.


previous | index | next