I think you're going to need a Converter for your Object. JSF has to be
told how to convert the object to a String to display on the client, as
well as how to convert that String back to the object in question.
On 1/7/10 5:08 PM, webtier_at_javadesktop.org wrote:
> Hi I'm trying to write a custom UIComponent which accepts attributes which are of a non-native type.
> I've already written custom UIComponents which use String and ints as attributes but now I want a
>
> i.e. in my Jsf I want to put something like
>
> <foo:renderMyObject myOwnObject="#{myJsfBean.myOwnObject}" />
>
> I already know how to do this for String and int and other built-in primitive types so I'm specifically asking about Custom classes only.
>
> So what I've tried is something like this (which doesn't work) :
>
> public class MyOwnObject
> {
> }
>
>
> @ManagedBean
> public class MyJsfBean
> {
> public MyOwnObject getMyOwnObject() ...
> }
>
> @FacesComponent(value="renderMyObject")
> public class RenderMyObject extends UIComponentBase
> {
> private MyOwnObject myOwnObject=null;
>
> public void setMyOwnObject(MyOwnObject x) ...
> }
>
> In the above example, the getMyOwnObject() is never even called in the JSF Managed Bean, and the setMyOwnObject is never called in the component. I'm thinking there's something special about custom objects which I can't seem to find any documentation about... If I switch the above to String instead of my custom object it all works.
>
> Anyone know how I'm suppose to properly do the above? Thanks.
> [Message sent by forum member 'tedman' (tedman_at_sfu.ca)]
>
> http://forums.java.net/jive/thread.jspa?messageID=379456
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>
--
Jason Lee
Senior Java Developer
GlassFish Administration Console
Sun Microsystems, Inc.
Phone x31197/+1 405-343-1964
Email jasondlee_at_sun.com
Blog http://blogs.sun.com/jasondlee
Blog http://blogs.steeplesoft.com