Download docx - Visualforce report

Transcript
Page 1: Visualforce report

VISUALFORCE

GOVT. ENGINEERING COLLEGE BIKANER

A SEMINAR REPORT

SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE AWARD OF

THE DEGREE OF

BACHELOR OF TECHNOLOGY(Computer Science Engineering)

SUBMITTED TO

RAJASTHAN TECHNICAL UNIVERSITY, KOTA

SUBMITTED TO : SUBMITTED BYMrs Manisha ma’amCSE Department

Rinku Saini13EEBCS066

Page 2: Visualforce report
Page 3: Visualforce report

ACKNOWLEDGEMENTI would like to place on record my deep sense of gratitude to Prof. Manoj Kudi, HOD-Dept. of Computer Science Engineering, Govt. Engineering College Bikaner, India for his generous guidance, help and useful suggestions.

I express my sincere gratitude to Mrs Manisha Govt. Engineering College Bikaner, Rajasthan, encouragement and supervision throughout the course

ma’am., Dept. of Computer Science Engineering, India, for his stimulating guidance, continuous of present work.

I also wish to extend my thanks to Prof Vikram Singh Chouhan and other colleagues for attending my seminars and for their insightful comments and constructive suggestions to improve the quality of this Seminar work.

I am extremely thankful to Mr.J.P. Bhamu, Principal, Govt. Engineering College Bikaner, for providing me infrastructural facilities to work in, without which this work would not have been possible.

Signature of Student

Rinku Saini (13EEBCS066)

Page 4: Visualforce report

ABSTRACT

Visualforce is the component-based user interface framework for the Force.com platform. The framework includes a tag-based markup language, similar to HTML. Each Visualforce tag corresponds to a coarse or fine-grained user interface component, such as a section of a page, or a field. Visualforce boasts about 100 built-in components, and a mechanism whereby developers can create their own components. Visualforce uses the traditional model-view-controller (MVC) paradigm, with the option to use auto-generated controllers for database objects, providing simple and tight integration with the database. You can write your own controllers, or extensions to controllers, using Apex Code. Visualforce also provides AJAX components, and embeds the formula expression language for action, data and component binding interaction. A developer creates Visualforce pages by composing components, HTML, and optional styling elements on the Force.com platform. Just like HTML, Visualforce can integrate with any standard web technology or JavaScript framework to allow for a more animated and rich user interface. Each page is then accessible by a unique URL. When someone accesses a page, the server renders the page..

Page 5: Visualforce report

TABLE OF CONTENTS

Page No.

Acknowledgement........................................................................................................................................i

Abstract............................................................................................................................................................ii

Chapter 1: What is Visualforce?.............................................................................................................1

Chapter 2: What is Visualforce Page?...................................................................................................2

Chapter 3: Where Can Visualforce Pages Be Used?...........................................................................3

Chapter 4: How to create visualforce page?.........................................................................................4

Chapter 5: Which Editions Support Visualforce?................................................................................5

Chapter 6: Which Permissions are Required for Visualforce Development?.................................6

Chapter 7: How is Visualforce Architected?........................................................................................6

Chapter 8: Tags of visualforce................................................................................................................8

Chapter 9: What are the Benefits of Visualforce?...............................................................................9

Chapter 10: Controller in visualforce....................................................................................................11

Conclusion………………………………………………………………………...15

References....................................................................................................................................................16

Page 6: Visualforce report
Page 7: Visualforce report

Chapter-1

What is visualforce :- Visualforce is a framework that allows developers to build sophisticated, custom user interfaces that can be hosted natively on theForce.com platform. The Visualforce framework includes a tag-based markup language, similar to HTML, and a set of server-side “standardcontrollers” that make basic database operations, such as queries and saves, very simple to perform.In the Visualforce markup language, each Visualforce tag corresponds to a coarse or fine-grained user interface component, such as asection of a page, a related list, or a field. The behavior of Visualforce components can either be controlled by the same logic that is usedin standard Salesforce pages, or developers can associate their own logic with a controller class written in Apex.

Page 8: Visualforce report

Chapter-2

What is visualforce page Developers can use Visualforce to create a Visualforce page definition. A page definition consists of two primary elements: • Visualforce markup • A Visualforce controller

Visualforce Markup :-Visualforce markup consists of Visualforce tags, HTML, JavaScript, or any other Web-enabled code embedded within a single<apex:page> tag. The markup defines the user interface components that should be included on the page, and the way they shouldappear.

Visualforce Controllers :-A Visualforce controller is a set of instructions that specify what happens when a user interacts with the components specified in associatedVisualforce markup, such as when a user clicks a button or link. Controllers also provide access to the data that should be displayed in apage, and can modify component behavior.

Page 9: Visualforce report

Chapter-3

Where Can Visualforce Pages Be Used?

Developers can use Visualforce pages to• Override standard buttons, such as the New button for accounts, or the Edit button for contactsor• Override tab overview pages, such as the Accounts tab home page• Define custom tabs• Embed components in detail page layouts• Create dashboard components or custom help pages• Customize, extend, or integrate the sidebars in the Salesforce console (custom console components)• Add menu items, actions, and mobile cards in Salesforce1

Page 10: Visualforce report

Chapter-4

How to create visualforce page

With development mode enabled, you can create your first Visualforce page by entering a URL for the page in your browser's address bar as follows: https://salesforce_instance/apex/pageName this give error message Because the page does not yet exist, you are directed to an intermediary page from which you can create your new page. Click Create Page <myNewPageName> to create it automatically.

Page 11: Visualforce report

Chapter-5

Which Editions Support Visualforce? Visualforce is available in Contact Manager Group Professional Enterprise Unlimited Performance, and Developer Editions.

Chapter-6

Which Permissions are Required for Visualforce Development? Visualforce development requires various permissions, depending on the specific activity. User Permissions NeededTo enable Visualforce development mode: “Customize Application”To create, edit, or delete Visualforce pages: “Customize Application”To create and edit custom Visualforce components: “Customize Application”To edit custom Visualforce controllers or Apex “Author Apex”To set Visualforce page security: “Manage Profiles and Permission Sets”To set version settings for Visualforce pages: “Customize Application”To create, edit, or delete static resources: “Customize Application”To create Visualforce Tabs: “Customize Application

Page 12: Visualforce report

Chapter-7

How is Visualforce Architected? All Visualforce pages run entirely on the Force.com platform, both when a developer creates the page, and when an end user requests a page, as shown in the following architecture diagrams.

When a developer finishes writing a Visualforce page and saves it to the platform, the platform application server attempts to compile the markup into an abstract set of instructions that can be understood by the Visualforce renderer. If compilation generates errors, the save is aborted and the errors are returned to the developer. Otherwise, the instructions are saved to the metadata repository and sent to the Visualforce renderer. The renderer turns the instructions into HTML and then refreshes the developer's view, thereby providing instantaneous feedback to the developer for whatever changes were made in the markup.

Page 13: Visualforce report

The architecture diagram below shows the process flow when a non-developer user requests a Visualforce page. Because the page is already compiled into instructions, the application server simply retrieves the page from the metadata repository and sends it to the Visualforce renderer for conversion into HTML.

Page 14: Visualforce report

Chapter-8

Tags of visualforce 1 <apex:page> calls an action when the page is loaded

2 <apex:actionFunction> defines a new JavaScript function that calls an action

3<apex:stylesheet value="{!$Resource.<filename>}"/> 4<apex:outputText> 5<apex:commandButton> creates a button that calls an action 6<apex:commandLink> creates a link that calls an action

7 <apex:actionSupport> makes an event (such as “onclick”“onmouseover”, and so on) on another, named component, call an action

8<apex:pageBlock > 9<apex:pageBlockTable value="{!accounts}" var="a">

10 <apex:column value="{!a.name}"/>11 <apex:form id="theForm">12 <apex:pageBlockTabel> create a table13 .<apex:inputField>

14.<apex:inputText> 15.<apex:inputTextArea>

Chapter-9

Page 15: Visualforce report

What are the Benefits of Visualforce? As a markup language, Visualforce provides the following benefits:

1.User-friendly development :-

Developers can edit their Visualforce markup in the same window that displays the resulting page. Consequently, developers can instantly verify the result of an edit just by saving their code. The Visualforce editor pane also includes auto-completion and syntax highlighting.

2.Integration with other Web-based user interface technologies :-

Because Visualforce markup is ultimately rendered into HTML, designers can use Visualforce tags alongside standard HTML, JavaScript, Flash, or any other code that can execute within an HTML page on the platform, including Force.com platform merge fields and expressions.

3.Model-View-Controller (MVC) style development :-

Visualforce conforms to the Model-View-Controller (MVC) development pattern by providing a clear division between the view of an application (the user interface, defined by Visualforce markup), and the controller that determines how the application works (the business logic, defined by a Visualforce controller written in Apex). With this architecture, designers and developers can easily split up the work that goes with building a new application—designers can focus on the look and feel of the user interface, while developers can work on the business logic that drives the app.

Page 16: Visualforce report

4.Concise syntax :-

Visualforce pages can implement the same functionality as s-controls but with approximately 90% fewer lines of code.

5.Data-driven defaults :-

Visualforce components are rendered intelligently by the platform. For example, rather than forcing page designers to use different component tags for different types of editable fields (such as email addresses or calendar dates), designers can simply use a generic <apex:inputField> tag for all fields. The Visualforce renderer displays the appropriate edit interface for each field.

.6.Automatically upgradeable :-

Visualforce pages do not need to be rewritten when other parts of the Force.com platform are upgraded. Because the pages are stored as metadata, they are automatically upgraded with the rest of the system.

Chapter-10

Page 17: Visualforce report

Controller in visualforce

A Visualforce controller is a set of instructions that specify what happens when a user interacts with the components specified in associated Visualforce markup, such as when a user clicks a button or link. Controllers also provide access to the data that should be displayed in a page, and can modify component behavior. Types of Controllers :-

1. Standard Controller2. Custom Controller3. Extension

Standard Controler:-

The Force.com platform provides a number of standard controllers that contain the same functionality and logic that are used for standardSalesforce pages. For example, if you use the standard Accounts controller, clicking a Save button in a Visualforce page results in thesame behavior as clicking Save on a standard Account edit page.A standard controller exists for every Salesforce object that can be queried using the Force.com API.

To associate a standard controller with a Visualforce page, use the standardController attribute on the <apex:page> tag and assign it the name of any Salesforce object that can be queried using the Force.com API. For example, to associate a page with the standard controller for a custom object named AccountObject, use the following markup :<apex:page standardController="Account"> </apex:page>

Page 18: Visualforce report

Every standard controller includes a getter method that returns the record specified by the id query string parameter in the page URL.This method allows the associated page markup to reference fields on the context record by using {!object} syntax, where object is the lowercase name of the object associated with the controller. For example, a page that uses the Account standard controller can use {!account.name} to return the value of the name field on the account that is currently in context.

Custom controllers and controller Extension :-

Standard controllers can provide all the functionality you need for a Visualforce page because they include the same logic that is used for a standard page. For example, if you use the standard Accounts controller, clicking a Save button in a Visualforce page results in the same behavior as clicking Save on a standard Account edit page.However, if you want to override existing functionality, customize the navigation through an application, use callouts or Web services, or if you need finer control for how information is accessed for your page, you can write a custom controller or a controller extension using Apex:

Page 19: Visualforce report

A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-levelsecurity of the current user.A controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when • You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit,view, save, or delete.• You want to add new actions.

Use Extension controller<apex:page controller="customControllerClass" extensions="extensionClass"> {!demo}<br/> {!show}</apex:page>

public class customControllerClass { public String demo='hello visualforce'; public String getdemo(){ return demo; }

}

public class extensionClass {

public extensionClass(customControllerClass controller) {

}

Page 20: Visualforce report

public String show ='This is the extension class'; public String getshow(){ return show; }

}Extension controller is used to extend the functionality of the custom and standard controller

Visualforce markup can use the following types of controller extension and custom controller methods:• Action• Getter• Setter

Conclusion

Page 21: Visualforce report

So Finally in this visualforce we have learn how to create visualforce pages,work off controller, mvc architecture etc.

We have learn how to make a dynamic web page using visualforce.

We can add all functionality of css,jquery and javascript.

Page 22: Visualforce report

References

http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf

http://www.salesforce.com/us/developer/docs/pages/salesforce_pages_developers_guide.pdf

https://trailhead.salesforce.com/en