You need to sign in to do that
Don't have an account?
ColinC
using Apex classes properties in VF pages
Is there any way to use Apex Classes in visualforce pages? If I have one of my own classes I can refer to it in a page from a property of the controller. I can also pass it to components - but I can't do much else. Specifically if my class has properties I would like to use their values. I can't get this to work.
For example if my class has a "public string Name" variable. I can even add a "public string getName() {return Name;}" property-like method. But in the page I can't refer to {!myInstance.Name} if myInstance is a controller property returning an item of my class.
SObjects seem to be the only values where the dot notation to get to properties actually works.
If I retunr a list of my class from the controller property I can then use the properties of my class in a repeat loop. I just can't with a single item - not unless I do something goofy like return a list of one item.
Am I missing something?
Message Edited by ColinC on 06-19-2008 08:46 AM
For example if my class has a "public string Name" variable. I can even add a "public string getName() {return Name;}" property-like method. But in the page I can't refer to {!myInstance.Name} if myInstance is a controller property returning an item of my class.
SObjects seem to be the only values where the dot notation to get to properties actually works.
If I retunr a list of my class from the controller property I can then use the properties of my class in a repeat loop. I just can't with a single item - not unless I do something goofy like return a list of one item.
Am I missing something?
Message Edited by ColinC on 06-19-2008 08:46 AM
Following example shows binding to a apex-property as well as using getter to get a value.
It works if I say:
Or:
i.e. if mySomething is an Sobject.
How can I return an Apex Class and access the properties of it without it being a list or an sobject.
Message Edited by ColinC on 06-19-2008 01:09 PM
My class is part of a package (that will eventually go on appex). The controller isn't. That setup doesn't work. If I take the class out of the package it works fine.
Message Edited by ColinC on 06-20-2008 12:10 AM