Reputation: 662
I've stumbled upon this tutorial and decided to try it out :-).
In the tutorial, they use a List with a valuechangelistener to change the language when something else was chosen.
I'm wondering how the same could be achieved for changing lanuage by clicking on an image?
<h:graphicImage url="http://icons.iconarchive.com/icons/custom-icon-design/flag-3/16/Netherlands- Flag-icon.png" value="#{languageController.localeCode}" onclick="submit()"/>
obviously didn't work. Any tips?
Upvotes: 1
Views: 425
Reputation: 1109874
So, you basically want an <a><img /></a>
? Just put the image inside a <h:commandLink>
.
<h:form>
<h:commandLink action="#{languageController.setLocaleCode('nl')}">
<h:graphicImage name="images/nl-flag.png" />
</h:commandLink>
</h:form>
I'm assuming that your environment supports Servlet 3.0 / EL 2.2.
Upvotes: 1