You need to sign in to do that
Don't have an account?

couple of doubts on controller
<apex:page Controller="Delet">
<apex:form >
<center>
<apex:pageBlock >
<b>Category: </b>
<apex:selectList value="{!ctgry}" size="1">
<apex:selectOptions value="{!ctgrys}"/>
</apex:selectList>
</apex:pageBlock>
</center>
</apex:form>
</apex:page>
public class Delet
{
public String[] ctgry = new String[]{};
public Delet()
{
}
public List<SelectOption> getCtgrys()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}
public String[] getCtgry()
{
return ctgry;
}
public void setCtgry(String[] ctgry)
{
this.ctgry = ctgry;
}
}
Can some one tell me in the above code,what is   and in the line public String[] ctgry = new String[]{};
why [] and {} both the braces is used and what does that line mean.
why MEXICO','Mexico' caps and small letters used.why constructor,getter and setter used.
<apex:form >
<center>
<apex:pageBlock >
<b>Category: </b>
<apex:selectList value="{!ctgry}" size="1">
<apex:selectOptions value="{!ctgrys}"/>
</apex:selectList>
</apex:pageBlock>
</center>
</apex:form>
</apex:page>
public class Delet
{
public String[] ctgry = new String[]{};
public Delet()
{
}
public List<SelectOption> getCtgrys()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}
public String[] getCtgry()
{
return ctgry;
}
public void setCtgry(String[] ctgry)
{
this.ctgry = ctgry;
}
}
Can some one tell me in the above code,what is   and in the line public String[] ctgry = new String[]{};
why [] and {} both the braces is used and what does that line mean.
why MEXICO','Mexico' caps and small letters used.why constructor,getter and setter used.
String[] ctgry = new String[]{} is use for string type list.
new String[]{'MEXICO','Mexico'}.
getCtgrys() is for get value on page from controller.
and setCtgry() is for set value to controller to page.