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

SmokingAPipe do-not-reply at jboss.com
Sun Jan 7 22:38:35 EST 2007


I have a class that looks like this:

  | public class Foo {
  |    public String name;
  |    public String favoriteColor;
  | }
  | 

When I try to access this in EL, using something like #{foo.name} it gives me an exception because it says that "name" is not a bean property.  I can fix the problem by adding getters and setters, of course, but for this class, I would prefer to just use public members.  Is such a thing possible?

I realize that public members are usually considered bad Java, but in this case, it really is a data transfer object, used much like a C struct, and it does make sense for them to be public.


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

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



More information about the jboss-user mailing list