You need to sign in to do that
Don't have an account?
How to use a property defined in a class while designing a VF page?
Hi,
I want to display a link in a VF page using the following code:
<apex:outputLink value="{!Hello}">KICCP</apex:outputLink>
while Hello is a property defined in a class named Kiccp ,here is my VF page header and class Kiccp code:
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" controller="Kiccp">
public class Kiccp{
public Kiccp(){}
public String Hello {
get{ return Hello;}
set{ Hello=value; }
}
}
The result is that the outputlink is my index page! I don't know why!
Could some one tell me how to initialize the property of a class? in which tag to do this?
Thanks!
Hi,
You have defined the property perfectly in the class. The only problem i see here is that the property "Hello" is not getting set to a particular value, which is why your page is redirecting it to the index page.
Try and set the value of Hello in the constructor as for example:
public Kiccp()
{
Hello = 'http://www.google.com';
}
I hope this is what you were trying to achieve.
All Answers
Hi,
You have defined the property perfectly in the class. The only problem i see here is that the property "Hello" is not getting set to a particular value, which is why your page is redirecting it to the index page.
Try and set the value of Hello in the constructor as for example:
public Kiccp()
{
Hello = 'http://www.google.com';
}
I hope this is what you were trying to achieve.
It works! Thanks for you answer!
I have been busy with other things and had no time to view this post ,please forgive me for responsing to you so late.
Thanks again.