Hi all,

 

my goal is to have an EJB backing bean like the following:

 

@Entity

public class EntityBean {

                //... id stuff and else properties

 

                private String color;

 

                public String getColor() {

                                return color;

                }

                public void setColor(String color) {

                               this.color = color;

                }

}

 

and directly getting / setting the value from / to and <tr:inputColor>

 

<ui:composition>

<tr:panelFormLayout>

<tr:inputColor label="Select color" value="#{entity.color}">

</tr:panelFormLayout>

</ui:composition>

 

Is is in some possible?

I already tried it with the <tr:convertColor> converter, but the value that is 
passed to the entity is always a java.awt.color instance (causing an argument 
type mismatch on submit of the form).

One way I can think of is to put @Transient getter / setter in the EntityBean 
that convert from color to string and vice versa. But this would be ugly 
because there will be more than one color in the EntityBean what would result 
in A LOT OF duplicated getter/setter just for converting stuff.

 

Any easy way to handle this?

 

Thanks for help

Markus

 

PS. I'm using JBoss 4.2.2, Myfaces 1.1.5, Trinindad 1.0.7, Facelets 1.1.13

Reply via email to