Visualforce는 MVC디자인 패던을 사용함
Visualforce page이름: test01
apex controller이름: test01Controller
->나중에도 같은 이름으로 만들어야 하나?
{! contracts }
는 컨트롤러의 getSomeExpression()
이라 이름이 지정된 메서드에 연결해 해당 메서드에 대한 호출로 변환.
NewCaseList - Visualforce page
<!-- 이 페이지의 Controller가 NewCaseListController.apex라고 명시 -->
<apex:page controller="NewCaseListController">
<!-- The NewCaseList Visualforce page must use an apex:repeat component, which is => 확인 -->
<apex:repeat var="case" value="{!newCases}">
<!-- Bound to newCases => 확인, Controller의 getNewCase-->
<!-- Refers to the var attribute as case => 확인 -->
<apex:outputLink value="/{!case.Id}">
<apex:outputText value="{!case.CaseNumber}"></apex:outputText>
</apex:outputLink>
</apex:repeat>
</apex:page>
ApexController
public class NewCaseListController {
//Include a publicly scoped method named getNewCases -> 확인
//Use the return type of List<Case> -> 확인
public LIST<Case> getNewCases(){
// Filter the results returned to only have a status of New -> 확인
// Return a list of case records that includes the ID and CaseNumber fields -> 확인
LIST<Case> filterList = [SELECT Id, CaseNumber FROM Case where status = 'New'];
return filterList;
}
}