[jboss-user] [JBoss Seam] - creating Edit forms for transaltable entities - and keep ma

marius.oancea do-not-reply at jboss.com
Mon Oct 15 05:45:34 EDT 2007


If you edit simple objects like Users, you can have thinks like:
<h:inputText value="#{user.username}" required="true"/>

This is very simple because user.username is a simple string and binding to the input fields is evident.

How one would approach the following problem:

I have a entity named "Word". Word has a name that is different in every language. So I have the following structure:

Word                                          Translation
====                                         ==========
name : Translation -------------->  language: String
                                                  text: String


Binding input fields like below, is not possible:

<h:inputText value="#{word.name(selectedLanguage)}" required="true"/> 


What is the most elegant way to solve that?

Note:
  selectedLanguage is a statefull component.

One posibility is to create a WordWrapper component in wich I inject selectedLanguage, and a word object. Then I provide methods for binding (set/get for name in selected language). This will work I think but I have very many Classes like Word and will be much work. 

Any better approach to write less code ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095162#4095162

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095162



More information about the jboss-user mailing list