visualforce 页面显示未知方法错误

我有 2 个包装类,如下所示

public class Wr_Studennt{
    public string name{get;set;}
    public decimal salary{get;set;}
    public decimal exp{get;set;}
    public string technology{get;set;}
    
}

public class Wr_Address {
    public String city{get;set;}
    public string place{get;set;}
    public string pincode{get;set;}
    public String state{get;set;}
}

我有如下顶点类

public class wr_Student_Address {
    public Wr_Studennt st{set;get;}
     public wr_student_Address()
    {
        st=new Wr_Studennt();
        
           }
    public void setstudent(string name,decimal salary,decimal exp,string technology)
    {
        st.name=name;
        st.salary=salary;
        st.exp=exp;
        st.technology=technology;
        
    }
    
    
}

我的 VF 页面如下

<apex:page controller="wr_Student_Address">
    <apex:form>
   <apex:pageblock title="Student Details">
    <apex:pageBlockSection>
        
        <apex:outputLabel value="Name: "/>
                    <apex:inputText value="{!name}" />
        <apex:outputLabel value="Salary: "/>
                    <apex:inputText value="{!salary}" />
        <apex:outputLabel value="Exp: "/>
                    <apex:inputText value="{!exp}" />
        <apex:outputLabel value="Technology: "/>
                    <apex:inputText value="{!technology}" />
       
          <apex:commandButton value="setstudent" action="{! setstudent}" />
        
       </apex:pageBlockSection>
    </apex:pageblock>


</apex:form>

</apex:page>

显示

第 0 行中的未知属性“wr_Student_Address.name”错误。

请帮我解决这个问题。 visualforce 页面显示

未知方法错误

tjdalele 回答:visualforce 页面显示未知方法错误

您的页面控制器 wr_Student_Address 只有 1 个属性:st。该类中没有直接称为 name 的字段。

尝试合并字段 {!st.name}

本文链接:https://www.f2er.com/246843.html

大家都在问