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
Rafael Franco Moreno 24Rafael Franco Moreno 24 

visualforce page error Unknown property 'mensajeController.mensajeContenido'

why I got this message?

Unknown property 'mensajeController.mensajeContenido'

this the vf page

<apex:page controller="mensajeController"  >
<apex:form >
 <apex:pageBlock >
 <apex:pageBlockButtons >
   <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="test"/>
  </apex:pageBlockButtons>
  <apex:pageBlockTable value="{!contacts}" var="c" >
   <apex:column >
    <apex:inputCheckbox value="{!c.selected}"/>
   </apex:column>
    <apex:column value="{!c.con.Name}" />
    <apex:column value="{!c.con.Email}" />
    <apex:column value="{!c.con.Phone}" />
  </apex:pageBlockTable>
 </apex:pageBlock>
    <apex:pageBlock>
        <p>Current description: {!mensajeContenido}</p>
        <p>Change description to:</p> 
        <apex:inputTextarea id="newDesc" value="{!mensajeContenido}"/><p/>
        <apex:commandButton value="Save" action="{!save}"/>
    </apex:pageBlock>
 <apex:pageBlock id="test">
  Total No of Selected Records :<apex:outputText value="{!value }"/>
  <apex:pageBlockTable value="{!SelectedContacts}" var="c" >
    <apex:column value="{!c.Name}" />
    <apex:column value="{!c.Email}" />
    <apex:column value="{!c.Phone}" />
  </apex:pageBlockTable>
 </apex:pageBlock>
 </apex:form>
</apex:page>

this is the controller

public class mensajeController {
    public List<cContact> contactList {get; set;}
    public List<Contact> selectedContacts{get;set;}
    public Integer value {get;set;}
    public List<cContact> getContacts() {
        if(contactList == null) {
            contactList = new List<cContact>();
            for(Contact c : [select Id, Name, Email, Phone from Contact]) {
            contactList.add(new cContact(c));
            }
        }
    return contactList;
}
public PageReference processSelected() {
    selectedContacts = new List<Contact>();
    for(cContact cCon : getContacts()) {
        if(cCon.selected == true) {
        selectedContacts.add(cCon.con);
        }
    }
    value = selectedContacts.size();
    System.debug('printingtcontc'+selectedContacts.size());
    return null;
}
public List<Contact> getSelectedContacts(){
    System.debug('printingtcontc inside get'+selectedContacts.size());
    if(selectedContacts.size()>0)
       return selectedContacts;
    else return null;
}
public class cContact {
    public Contact con {get; set;}
    public Boolean selected {get; set;}
    public cContact(Contact c) {
    con = c;
    selected = false;
    }
}
    public class messageDescription {
        public string mensajeContenido {get; set;}
    }
}
 
Best Answer chosen by Rafael Franco Moreno 24
ravi soniravi soni
hi  Rafael,
you can not reference wrapper class method with vf page. you can create a variable and the directly use it.
public class mensajeController {
    public List<cContact> contactList {get; set;}
    public List<Contact> selectedContacts{get;set;}
    public string oMessageDescription{get;set;}
    public Integer value {get;set;}
    public List<cContact> getContacts() {
        if(contactList == null) {
            contactList = new List<cContact>();
            for(Contact c : [select Id, Name, Email, Phone from Contact]) {
            contactList.add(new cContact(c));
            }
        }
    return contactList;
}
    public  PageReference save(){
        system.debug('test===> ');
        return null;
    } 
public PageReference processSelected() {
    selectedContacts = new List<Contact>();
    for(cContact cCon : getContacts()) {
        if(cCon.selected == true) {
        selectedContacts.add(cCon.con);
        }
    }
    value = selectedContacts.size();
    System.debug('printingtcontc'+selectedContacts.size());
    return null;
}
public List<Contact> getSelectedContacts(){
    System.debug('printingtcontc inside get'+selectedContacts.size());
    if(selectedContacts.size()>0)
       return selectedContacts;
    else return null;
}
public class cContact {
    public Contact con {get; set;}
    public Boolean selected {get; set;}
    public cContact(Contact c) {
    con = c;
    selected = false;
    }
}
    public class messageDescription {
        public string mensajeContenido {get; set;}
    }
}
 
<apex:page controller="mensajeController"  >
<apex:form >
 <apex:pageBlock >
 <apex:pageBlockButtons >
   <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="test"/>
  </apex:pageBlockButtons>
  <apex:pageBlockTable value="{!contacts}" var="c" >
   <apex:column >
    <apex:inputCheckbox value="{!c.selected}"/>
   </apex:column>
    <apex:column value="{!c.con.Name}" />
    <apex:column value="{!c.con.Email}" />
    <apex:column value="{!c.con.Phone}" />
  </apex:pageBlockTable>
 </apex:pageBlock>
    <apex:pageBlock>
        <!--<p>Current description: {!mensajeContenido}</p>-->
        <p>Current description: {!oMessageDescription}</p>
        <p>Change description to:</p> 
        <!--<apex:inputTextarea id="newDesc" value="{!mensajeContenido}"/><p/>-->
        <apex:inputTextarea id="newDesc" value="{!oMessageDescription}"/><p/>
        
        <apex:commandButton value="Save" action="{!save}"/>
    </apex:pageBlock>
 <apex:pageBlock id="test">
  Total No of Selected Records :<apex:outputText value="{!value }"/>
  <apex:pageBlockTable value="{!SelectedContacts}" var="c" >
    <apex:column value="{!c.Name}" />
    <apex:column value="{!c.Email}" />
    <apex:column value="{!c.Phone}" />
  </apex:pageBlockTable>
 </apex:pageBlock>
 </apex:form>
</apex:page>

try above code and let me know if it works.
don't forget to mark it as best answer.
Thank you

All Answers

ravi soniravi soni
hi  Rafael,
you can not reference wrapper class method with vf page. you can create a variable and the directly use it.
public class mensajeController {
    public List<cContact> contactList {get; set;}
    public List<Contact> selectedContacts{get;set;}
    public string oMessageDescription{get;set;}
    public Integer value {get;set;}
    public List<cContact> getContacts() {
        if(contactList == null) {
            contactList = new List<cContact>();
            for(Contact c : [select Id, Name, Email, Phone from Contact]) {
            contactList.add(new cContact(c));
            }
        }
    return contactList;
}
    public  PageReference save(){
        system.debug('test===> ');
        return null;
    } 
public PageReference processSelected() {
    selectedContacts = new List<Contact>();
    for(cContact cCon : getContacts()) {
        if(cCon.selected == true) {
        selectedContacts.add(cCon.con);
        }
    }
    value = selectedContacts.size();
    System.debug('printingtcontc'+selectedContacts.size());
    return null;
}
public List<Contact> getSelectedContacts(){
    System.debug('printingtcontc inside get'+selectedContacts.size());
    if(selectedContacts.size()>0)
       return selectedContacts;
    else return null;
}
public class cContact {
    public Contact con {get; set;}
    public Boolean selected {get; set;}
    public cContact(Contact c) {
    con = c;
    selected = false;
    }
}
    public class messageDescription {
        public string mensajeContenido {get; set;}
    }
}
 
<apex:page controller="mensajeController"  >
<apex:form >
 <apex:pageBlock >
 <apex:pageBlockButtons >
   <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="test"/>
  </apex:pageBlockButtons>
  <apex:pageBlockTable value="{!contacts}" var="c" >
   <apex:column >
    <apex:inputCheckbox value="{!c.selected}"/>
   </apex:column>
    <apex:column value="{!c.con.Name}" />
    <apex:column value="{!c.con.Email}" />
    <apex:column value="{!c.con.Phone}" />
  </apex:pageBlockTable>
 </apex:pageBlock>
    <apex:pageBlock>
        <!--<p>Current description: {!mensajeContenido}</p>-->
        <p>Current description: {!oMessageDescription}</p>
        <p>Change description to:</p> 
        <!--<apex:inputTextarea id="newDesc" value="{!mensajeContenido}"/><p/>-->
        <apex:inputTextarea id="newDesc" value="{!oMessageDescription}"/><p/>
        
        <apex:commandButton value="Save" action="{!save}"/>
    </apex:pageBlock>
 <apex:pageBlock id="test">
  Total No of Selected Records :<apex:outputText value="{!value }"/>
  <apex:pageBlockTable value="{!SelectedContacts}" var="c" >
    <apex:column value="{!c.Name}" />
    <apex:column value="{!c.Email}" />
    <apex:column value="{!c.Phone}" />
  </apex:pageBlockTable>
 </apex:pageBlock>
 </apex:form>
</apex:page>

try above code and let me know if it works.
don't forget to mark it as best answer.
Thank you
This was selected as the best answer
Rafael Franco Moreno 24Rafael Franco Moreno 24
it doesn´t worked but I deleted this code and it worked:

public class messageDescription { public string mensajeContenido {get; set;} }

thank you