+ Start a Discussion
manjunath vivekmanjunath vivek 

couple of doubts on controller

<apex:page Controller="Delet">

<apex:form >

  <apex:pageBlock >
    <apex:selectList value="{!ctgry}" size="1">
      <apex:selectOptions value="{!ctgrys}"/>

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 &nbsp;&nbsp 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.
Ravikant Saini 1Ravikant Saini 1
Hi manjunath,
     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.
manjunath vivekmanjunath vivek
You have any idea what is &nbsp;&nbsp and why  MEXICO','Mexico' caps and small letters used.
pankaj kabra 8pankaj kabra 8
&nbsp;&nbsp is used for providing two spaces and MEXICO capital is for display and Mexico will get stores in database.