<apex:page >
属性:
- title:在页面中显示的标题
- controller:对应的后台控制器
- tabstyle:选择对象的选项卡样式
- sidebar: 侧边栏是否显示,默认为:
true
- showHeader:是否显示标签名称,默认为
true
- applyBodyTag:是否禁用
body
,默认为true
- applyHtmlTag:是否禁用
html
,默认为:true
- docType:描述文档类型:
"html-4.01-strict", "xhtml-1.0-transitional", "xhtml-1.1-basic", "html-5.0",
- standardStylesheets:是否引入自带的sf样式,默认
true
<apex:form>
- id
<apex:pageBlock>
类似于选项卡
- title:显示的内容
- mod:样式,默认为:
detail
,可选参数:detail 、maindetail 、edit 、inlineEdit
<apex:messages>
显示错误信息
<apex:pageBlockSection>
选项组
- title : 名称
- columns : 跨多少行
<apex:panelGrid>
在HTML
中对应的表格
- columns :一行中显示的多少字段
- id:id
<apex:selectList >
- multiselect:是否可以选多个,如果为
true
代表可以选多个,默认false
- size:默认显示几条,默认显示全部有效数据
- value:值
<apex:selectOptions>
- value:值
<apex:inputText>
输入框
< apex:actionStatus/>
用于Ajax
请求
- startText:请求之前显示的文本信息
- stopText: 请求之后显示的文本信息
<apex:commandButton>
类似于:
<input id="thePage:theForm:theButton" type="submit" name="thePage:theForm:theButton" value="Save" />
- action:调用控制器的方法,如果用户权限不够,则调用失败
- value:按钮的显示值
- id:id
- disabled:是否只读,默认为:false
- status:于ajax相关联的组件
简单用法
<apex:actionStatus id="query_user_status">
<apex:facet name="stop">
<apex:commandButton value="搜索" action="{!searchUsers}" status="query_user_status" reRender="the_form"/>
</apex:facet>
<apex:facet name="start">
<apex:commandButton value="搜索中" disabled="true" status="query_user_status"/>
</apex:facet>
</apex:actionStatus>
<apex:pageBlockTable>
类似于tbody
标签
- value:需要显示的集合
- var:别名
<apex:column/>
配合<apex:pageBlockTable>
标签使用,类似于td
标签
- headerValue:表头
示列
<apex:pageBlock title="My Content">
<apex:pageBlockTable value="{!account.Contacts}" var="item">
<apex:column value="{!item.name}"/>
<apex:column value="{!item.phone}"/>
</apex:pageBlockTable>
<apex:inputCheckbox/>
复选框
<apex:outputField>
类似于span
的标签
- value : 值
<apex:actionFunction/>
调用控制器的组件
- action:调用控制器的方法
- reRender:本地刷新重新渲染,指定一个ID
- status:请求中,显示的状态,指定一个ID
<apex:actionPoller>
指定时间,发送AJAX
请求
列如
<apex:actionPoller action="{!incrementCounter}" reRender="counter" interval="15"/>
<apex:commandLink>
和html
中的a
标签差不多
<apex:component/>
和html
中的div
或者span
标签差不多
<apex:flash/>
引入flash
地址
<apex:insert/>
将此组件与<apex:composition>
和<apex:define>
组件在多个页面之间共享数据
<apex:map>
展示地图
<apex:facet>
动态组件,只能写在,父组件中
<apex:composition/>
引入标签
<apex:page>
<apex:outputText value="(template) This is before the header"/><br/>
<apex:insert name="header"/><br/>
<apex:outputText value="(template) This is between the header and body"/><br/>
<apex:insert name="body"/>
</apex:page>
<apex:page>
<apex:composition template="composition">
<apex:define name="header">(page) This is the header of mypage</apex:define>
<apex:define name="body">(page) This is the body of mypage</apex:define>
</apex:composition>
</apex:page>
<apex:dataList/>
数据集合
<apex:page controller="dataListCon">
<apex:dataList value="{!accounts}" var="account">
<apex:outputText value="{!account.Name}"/>
</apex:dataList>
</apex:page>
/*** Controller: ***/
public class dataListCon {
List<Account> accounts;
public List<Account> getAccounts() {
if(accounts == null) accounts = [SELECT Name FROM Account LIMIT 10];
return accounts;
}
}
apex:dynamicComponent componentValue="{!dynamicDetail}" />
动态生成组件
/* Controller */
public class SimpleDynamicController {
public Component.Apex.Detail getDynamicDetail() {
Component.Apex.Detail detail = new Component.Apex.Detail();
detail.expressions.subject = '{!acct.OwnerId}';
detail.relatedList = false;
detail.title = false;
return detail;
}
// Just return the first Account, for example purposes only
public Account acct {
get { return [SELECT Id, Name, OwnerId FROM Account LIMIT 1]; }
}
}
<apex:enhancedList> 和 <apex:ListViews />
显示视图列表
<apex:iframe/>
类似于网页框架
<apex:tab/>
选项卡
<!-- Page: -->
<apex:page id="thePage">
<apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
<apex:tab label="One" name="name1" id="tabOne">content for tab one</apex:tab>
<apex:tab label="Two" name="name2" id="tabTwo">content for tab two</apex:tab>
</apex:tabPanel>
</apex:page>
<apex:outputPanel/>
类似于span