[jboss-user] [JBoss Seam] - Re: Public members as bean properties within EL?

SmokingAPipe do-not-reply at jboss.com
Mon Jan 8 00:04:27 EST 2007


The problem I was running into was that unfortunately JAXB looks at both private fields and getter methods to determine properties, so if I have:


  | class Foo {
  |    private String name;
  |    public String getName() { return name; }
  | }
  | 

JAXB was giving me an error that there were two fields with the same name.  I then tried putting @XmlTransient on either the getter or the private member, and that messed everything up.  So I ended up removing the private fields by calling them private String _name, and then everything worked.

What's cool here is that I have a class that has Hibernate validators, so I can process it easily within forms, and Seam SFSBs can do stuff to it once it's valid, and that stuff can include marshalling it and sending it off... and it's all based on one single class file, which happens to have a bunch of annotations on it.  I go from a Web form straight to an XML stream, with Seam SFSBs acting as light-weight intermediaries, and with Facelets displaying nice validation messages as needed.  It is in fact pretty cool.  I guess if I wanted to be even more cool I could also make that object into an @Entity so it could also be persisted.


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

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



More information about the jboss-user mailing list