salesforce pagereference 和接收url上传递的参数
2013-12-21 21:04
387 查看
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_system_pagereference.htm salesforce 官方介绍 pagereference
pagereference
fullURL可以是一个完整的链接地址。也可以是一个相对路径。
也可以通过url中传递链接参数。string fullURL = 'http://www.baidu.com/s?wd=a';a 可以当做一个参数传递进去。
代码如下:
这个方法中 PageReference acctPage = new ApexPages.StandardController(account).view(); 默认调转到account默认的视图中(在pagelayout中自定义按钮中会用到这个方法)。 setRedirect(Boolean) Sets the value of the PageReference object's redirect attribute. If set to true, a redirect is performed through
a client side redirect.意思是说,设置成true,直接就从客户端跳转了。
pagereference
fullURL可以是一个完整的链接地址。也可以是一个相对路径。
也可以通过url中传递链接参数。string fullURL = 'http://www.baidu.com/s?wd=a';a 可以当做一个参数传递进去。
代码如下:
PageReference pageRef = new PageReference('fullURL');
这个方法中 PageReference acctPage = new ApexPages.StandardController(account).view(); 默认调转到account默认的视图中(在pagelayout中自定义按钮中会用到这个方法)。 setRedirect(Boolean) Sets the value of the PageReference object's redirect attribute. If set to true, a redirect is performed through
a client side redirect.意思是说,设置成true,直接就从客户端跳转了。
public PageReference save() { // Add the account to the database. insert account; // Send the user to the detail page for the new account. PageReference acctPage = new ApexPages.StandardController(account).view(); acctPage.setRedirect(true); return acctPage; }PageReference Instance Methods
getAnchor() Returns the name of the anchor referenced in the page’s URL. That is, the part of the URL after the hashtag (#). getContent() Returns the output of the page, as displayed to a user in a Web browser. getContentAsPDF() Returns the page as a PDF, regardless of the <apex:page> component's renderAs attribute. getCookies() Returns a map of cookie names and cookie objects, where the key is a String of the cookie name and the value contains the list of cookie objects with that name. getHeaders() Returns a map of the request headers, where the key string contains the name of the header, and the value string contains the value of the header. getParameters() Returns a map of the query string parameters that are included in the page URL. The key string contains the name of the parameter, while the value string contains the value of the parameter. getRedirect() Returns the current value of the PageReference object's redirect attribute. getUrl() Returns the relative URL associated with the PageReference when it was originally defined, including any query string parameters and anchors. setAnchor(String) Sets the URL’s anchor reference to the specified string. setCookies(Cookie[]) Creates a list of cookie objects. Used in conjunction with the Cookie class. setRedirect(Boolean) Sets the value of the PageReference object's redirect attribute. If set to true, a redirect is performed through a client side redirect.
相关文章推荐
- ASP.net中通过HyperLink的NavigateUrl属性传递参数,与新页面的Page_Load()接收参数
- jquery通过url传递 和 接收 参数
- form表单采用post提交方式提交,在url后面加问号再传递一个参数,提交后是否能接收到?
- jquery通过url传递 和 接收 参数
- Url传递参数和接收参数时的中文乱码处理
- js接收url传递的中文参数
- asp.net传递的中文url参数在asp页面如何正确接收
- 在ASP.NET里通过URL传递参数得到乱码的解决方法
- Spring MVC传递URL到后台参数为空
- JavaScript Base64编码和解码,实现URL参数传递。
- asp.net中url传递参数乱码的两种解决方案
- 根据传递的目录名,文件名参数转换输出外部访问的URL地址
- php无法接收java传递的post参数
- struts2配置文件中url传递参数中文乱码处理
- html url传递参数问题
- JavaScript中url 传递参数(特殊字符)解决方法
- Js的Url中传递中文参数乱码,如何获取Url中参数问题
- javascript通过url向jsp页面传递中文参数乱码解决方法
- perl 用参数传递URL地址进行HTML解析
- 获取URL地址传递的中文参数出现乱码!