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
Nitish KulkarniNitish Kulkarni 

Unknown property 'insertewsclass.resource' error using custom controller in visualforce page

I am getting unknown property error while using custom controller.I am using Developer console.please help

VisualForce code
<apex:page showHeader="false" controller="insertewsclass">
<apex:form >
<apex:image value="{!resource.logo}" width="220" height="100"/>
<apex:pageBlock tabStyle="Employment_Website__c">
<apex:outputText value="{!msg}" style="st"/><br/><br/>
<table boder="0" width="70%" height="70">
<td>EWS Name</td>
<td><apex:inputText value="{!name}"/></td>
<td>Price per post</td>
<td><apex:inputText value="{!pp}"/></td>
<td>Maximum budget</td>
<td><apex:inputText value="{!mb}"/></td>
<td><apex:inputText value="{!url}"/></td>
<td><apex:commandButton value="Insert" action="insert_rec" style="font-size:15px"/>
    &nbsp;<input type="reset" style="font-size:15px"/></td>

Apex code
public class insertewsclass {
    public string name{get;set;}
    public double pp{get;set;}
    public double mb{get;set;}
    public string url{get;set;}
    public string msg;
    public void insert_rec()
        integer namecount = [select count() from Employment_Website__c where Name = :name];
        integer urlcount = [select count() from Employment_Website__c where Website_address__c = :url];
    if(namecount > 0 || urlcount > 0)
      msg = 'Record Insertion Failed';
        Employment_Website__c ob = new Employment_Website__c();
        ob.Name = name;
        ob.Price_per_post__c = pp;
        ob.Maximum_budget__c = mb;
        ob.Website_address__c = url;
        msg = 'Record Inserted Successfully';
    public string getmsg()

Best Answer chosen by Nitish Kulkarni
Hi Nitish,

If you are static resource for image in vf page then you have to use this syntax
{!$Resource.logo}. You have missed $ sign.


All Answers

Alain CabonAlain Cabon

The problem is {!resource.logo} that is not resolved.

<apex:image value="{!resource.logo}" width="220" height="100"/>

You can try this at first:
<apex:image value="/img/logo.png" width="220" height="100" />

But you need to identify clearly what is this logo because there are many syntaxes for resolving the images:
Hi Nitish,

If you are static resource for image in vf page then you have to use this syntax
{!$Resource.logo}. You have missed $ sign.

This was selected as the best answer
Maharajan CMaharajan C
Hi Nitish,

Try the below change in the <apex:Image> Tag:

I think you are missing $

<apex:image url="{!$Resource.logo}" width="220" height="100"/>


<apex:image i value="{!$Resource.logo}" width="220" height="100" />

Can you please Let me know if it helps or not!!!

If it helps don't forget to mark this as a best answer!!!

Nitish KulkarniNitish Kulkarni

Thanks Alian , Jyoti and Maharaja.

I missed $ sign thatswhy it was not working.