function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ambitiambiti 

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!

 

 

 

Message Edited by ambiti on 03-09-2010 05:53 PM
Best Answer chosen by Admin (Salesforce Developers) 
rmehrmeh

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

rmehrmeh

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.

This was selected as the best answer
ambitiambiti

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.