Created
May 3, 2013 14:13
-
-
Save tyoshikawa1106/5509339 to your computer and use it in GitHub Desktop.
2つのページと同一コントローラーサンプル
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class SearchController { | |
public List<Account> accounts {get; set;} | |
public SearchController() { | |
this.accounts = new List<Account>(); | |
} | |
public void doSearch() { | |
this.accounts = [select Id,Name from Account limit 200]; | |
} | |
public PageReference doClick() { | |
return Page.ViewPage.setRedirect(false); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page controller="SearchController" title="SearchPage" showHeader="true" sidebar="false" id="page"> | |
<apex:form id="form"> | |
<apex:pageBlock id="block"> | |
<apex:pageBlockButtons > | |
<apex:commandButton value=" Search!! " title=" Search!! " action="{!doSearch}" reRender="form" /> | |
<apex:commandButton value=" Click!! " title=" Click!! " action="{!doClick}" rendered="{!accounts.size > 0}" /> | |
</apex:pageBlockButtons> | |
<apex:pageBlockTable value="{!accounts}" var="item"> | |
<apex:column headerValue="{!$ObjectType.Account.Fields.Name.Label}"> | |
<apex:outputText value="{!item.Name}" /> | |
</apex:column> | |
</apex:pageBlockTable> | |
</apex:pageBlock> | |
</apex:form> | |
</apex:page> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page controller="SearchController" title="ViewPage" showHeader="false" sidebar="false" id="page"> | |
<apex:form id="form"> | |
<apex:pageBlock id="block"> | |
<apex:pageBlockTable value="{!accounts}" var="item"> | |
<apex:column headerValue="{!$ObjectType.Account.Fields.Name.Label}"> | |
<apex:outputText value="{!item.Name}" /> | |
</apex:column> | |
</apex:pageBlockTable> | |
</apex:pageBlock> | |
</apex:form> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment