Tuesday, February 24, 2009

11G : How to create Popup in JDeveloper 11.1.1.0.1 ?

Steps for Create Popup in Jdeveloper 11.1.1.0.1 :


Step-1: Create an Application.

Step-2: Create a JSF page(Ex, neelPage.jspx)

Step-3: Drag the CommandButton ADF faces > Common Component (ex, Edit)UIComponent on the jsp page.

Step-4: Drag & Drop the UIComponent Popup ADF faces > Common Component UIComponent on the Jsp Page, and set id(Ex, editpopid).




Step-5: Drag some UI Componet(or table, form etc) on the popup, within PanelWindow.




Step-6: Drag & Drop the ShowPopupBehavior ADF Faces > Operations UIComponent on the CommandButton(Edit), and set the id the same as popup-in step-4(Ex, editpopid)

Step-7: Run the page.


Download the workspace

Monday, February 23, 2009

11G : How to create Declarative Component ?

Steps for creating Declarative Component in JDeveloper 11.1.1.0.1 ::

Step-1 : Create an Application(Ex, NeelApplication).

Step-2 : Select Project and choose NEW from the Context Menu.

Step-3 : Select JSF from Categories(Web Tier > JSF).

Step-4 : Select JSF Declarative Component than OK.

Step-5 : Put a Name(Ex, Neel_info) for Declarative Component in New windows.

Step-6 : Click on ADD TAG LIBRARY. A new Window will open.

Step-7 : Put the values for Tag_library_Name(ex,Neelmani), URL(ex, /Neelmani), Prefix(Ex, n)

Step-8 : Select + from facet Definitions.

Step-9 : put the value for Name(Ex, your_area).

Step-10: Click OK.

Step-11: Drag some UI component on Neel_info.jspx

Step-12: Go to Project Properties of the Application(select Project Properties from the context menu.))

Step-13: Select Deployment from Left side from the Project properties windows.

Step-14: Click NEW. than select ADF LIBRARY JAR FILE, than put a name. Click OK.

Step-15: Right click on the project than Deploy > Neelmani > to ADF Library JAR (wait for next few second)

Step-16: Copy the Path(where it deployed) from the LOG window.

Step-17: Open the Resource Palate(View > Resource Palate)

Step-18: In Resource palate (New Connection > File System).

Step-19: Put the Connection Name(Ex, Neelmaniconn).

Step-20: In Directory Path, paste the path(which you copied from the log window-in step16).

Step-21: Test Connection. Click OK.

Step-22: Explore the File system(In Resource palate).

Step-23: Right Click on the Jar file(Ex, Neelmani.jar) and Click on ADD TO PROJECT.

Step-24: If any warning cames, click on ADD JAR.

Step-25: Go to Component Palate. Declarative component(Neel_info) has been created under Neelmani(Tag lib).

10G : How to get a comma-separated list of clients by doing a multi-select from an LOV dialog?

Steps to get a comma-separated list of clients by doing a multi-select from an LOV dialog:


Step-1: go to faces-config.xml


Step-2: Search Page: Add search.jspx and create the page where you have an input box and a command button


Step-3: LOV Dialog Page: Add lov.jspx and create a page
a. drag and drop the view from datacontrol palette to add an ADF table .

b. through the table facets->selection of af:table in the structure pane, add the af:tableSelectMany .

c. through the table facets->action of af:table in the structure pane, add a command button for the table .


Step-4: Using the ADF Dialog Framework: Inside the faces-config, add a jsf navigation case from the search page to the dialog, when the action is dialog:lov


Step-5: Inside the search.jspx, add
a. partialTriggers="commandButton1" property for the input text box (InputText1)
b. action="dialog:lov", partialSubmit="true", returnListener="#{backing_search.returned}", useWindow="true" properties for the commandButton (commandButton1)




Step-6: Inside the backing bean search.java, add the following code to enter the returned value into the text box:







action="#{backing_lov.submit_action}"


Step-7: Inside the lov.java (backing bean), enter the following code for the submit_action method

This code will require some missing imports to be added so it works correctly.


Step-8: Inside the lov.jspx, for the commandButton, add the action property

10G : How to deploy the ADF Application ?

Steps for Deployment the ADF Application(seperatly....Model & ViewController) on the server(OAS)::

Step-A: Create DataBase Connection(Optional for test):-

Step-1 : StepPut the CONNECTION_NAME
Step-2 : Put USER NAME & PASSWORD (Of that schema where DataBase exist)
Step-3 : Put Host Name(ex. neel.yahoo.com ), Port(1521), SID(webdb).
Step-4 : Test the Connection OK


Step-B: Create Application server:-

Update the Host_File(RUN- Drivers>etc>Hosts) (Add the IP ADDRESS of the server and address of the server in the last of the file) (ex. 67.170.188.135 neel.yahoo.com neel.eal neel)

Step-5 : Put the connection name(ex, VenusAppSvr)
Step-6 : Put USER NAME & PASSWORD(of the server)
Step-7 : Put Host Name(ex. neel.yahoo.com ), OPMN_Port(5003), oc4j_Instance_Name(ex, Home)
Step-8 : Test the connection OK



ViewController:-

Step-C: WAR file creation :--

Step-9 : Right click on ViewController.
Step-10: Select New from Context Menu.
Step-11: In NEW GALARY select, General>Deployment Profile> WAR File.
Step-12: Give the Name...ex.webAPp1
Step-13: Select Radio Button(Specify Project J2ee web context Root).
Step-14: put...web context root of app(ex, webroot1)
Step-15: Select Prfile Dependencies,
Step-16: Check all the options of ViewController.jpr. OK


Step-D: EAR file creation :--

Step-17: Right click on ViewController.
Step-18: Select New from Context Menu.
Step-19: In NEW GALARY select,
Step-20: General>Deployment Profile> EAR File.
Step-21: Give the Name...ex.Application1
Step-22: Go to Application asembly,
Step-23: check all the conents under ViewController.jpr OK


Step-E: Deploy:-

Step-24: Right Click on the EAR File and Deploy on the Application server.

Tuesday, February 17, 2009

JSF : How to use the Switcher?

Use of the Switcher :

The switcher component dynamically decides which facet component should be rendered. It has two properties. The switcher will render the facet matching "facetName".

Step-1 : Create JSP page with Dropdown. Use Switcher with Facet.


--



Step-2 : Change autoSubmit and valuePassThrough property as True




Note : Switcher should be in any of the UI Component which have PartialTrigger Attribute.




Step-3 : Write some Code.





JSF : Navigation to another JSF page with Radio Button usage

Navigation to another JSF page with Radio Button usage:

Step-1 : Create the JSP Page with Radio Button.




.
.
.
Step-2 : Write Some Code.
.

11G : How to Create List of Values(LOV) ?

How to Create List of Values(LOV) in Jdeveloper 11.1.1.0.1 ?


Step-1 : Start JDeveloper by selecting Start > All Programs > Oracle WebLogic > JDeveloper Studio 11.1.1.0.0

Step-2 : Create a New Application and Project

Step-3 : Create the Database Connection(Ex, HRConnection for HR-schema)

Step-4 : Create ADF-BC(ex, Entity and View Object for Employee table).

Step-5 : Open Employee(EmployeesView.xml) View Object from Application Navigator.





Step-6 : Select Attribute > DepartmentId.

Step-7 : Goto LIST-OF-VALUES than click on + symbol.

Step-8 : Goto Configuration Tab on the List-of-value windows.

Step-9 : Click + symbol for LIST-DATA-SOURCE.






Step-10: select DepartmentView from Available and Sattle it to Rightside under EmployeeView than click ok.




Step-11: Now select DepartmentId from LIST-ATTRIBUTE dropdown.

Step-12: Goto UI-hint Tab.

Step-13: Select Input-text from List of value from Default list type.

Step-14: Select Department Name from Available and sattle it to Right Side.

Step-15: Check QueryListAutomatically than click OK.

Step-16: Goto ApplicationModule, select RUN from the Context menu, Click to CONNECT in next window.

Step-17: Double Click on EmployeeView1




Step-18: You can see the Browse Button for DepartmentID. Click on that.

Step-19: New Window with LOV will be open.

Wednesday, February 11, 2009

11G : ADF Life Cycle

ADF Lifecycle has Nine phases as follows:


        Fig: ADF Lifecycle

1> Initialize Context: In this phase value of associated request, binding container and lifecycle are set. Binding Container will get Initialized.
                                       
2> Prepare Model: In this phase model is prepared and initialized. In this phase page parameters are set and methods in the executable section of the page definition of the ADF page are executed. Page Parameter, Taskflow parameter & the Iterator which is having PrepareRender as refresh condition will get Initalized.

3> Apply Input Values: This phase handles the request parameters. These may come by adding the request parameters in the URL or as a result of HTML form post action. A list of events is build using these request parameters. These are actually mapped to the bindings in the pageDef. This phase resolves the list of request parameters bind to attributes in the page def. This results into a list of updatedValues which is used in Update Model phase.

4> Validate Input Values: This phase validates the list of values built in the Apply input values field with model.

5> Update Model: After validation of input values data model is updated with the list of values created in apply input values phase.

6> Validate Model Updates: Updates in the previous phase are then validated by calling the associated lifecycle's binding container .

7> Process Component Updates: This phase handles any events in the list built during the apply input values phase. Named events as well as all the events tied to the databindings created in the pagdef are handled in this phase.

8> Metadata Commit: This phase commits the runtime metadata changes to the model. This phase is always executed before prepare render phase.

9> Prepare Render: This is the final phase where page is sent for rendering. prepareRender event is sent to all the registered listeners. This notification signals bindings to prepare or process the data for rendering. Binding container is also refreshed. This helps in updating any changes that happened during validation phases.

11G : Scopes

ADF supports all the usual scope options as in JSF like none, requestScope, session scope and application scope. Along with these scoping options ADF supports one additional highly useful scope option that is, pageFlowScope. Let's talk about these options one by one in brief:
Let's take an usecase to understand it better. Say, there is a a page 'pageA' in your application having a selectOneChoice and a submit button. On clicking the submit button it navigates you to 'pageB'. There is a bean method assoicated with the selectOneChoiceList's value change listener. this method is simply storing the selected value of the list to a bean property.


Fig: Scopes in ADF

1. none: So, with none scope, on changing the the value in the list, the associated bean will be instantiated and the associaed listner method will be called. As soon as the control returns from the bean method the bean will be destroyed. In other words, you cannot access the bean property value after that even on the same page.


2. requestScope: if the bean scope is requestScope then the value stored in the bean property will be accessible even on the pageB. you can simply access it at #{requestScope.yourBean.yourPropertyName}. This bean will be destroyed as soon as you submit another request by say clicking back button to navigate to pageA or by clicking a submit button to do some other action which generates another request to the server.


3. pageFlowScope: This scope is an introduction of ADF. In ADF you can group some pages (called activity) in a logical unit called TaskFlow (more specifically a bounded task flow in this case). Say you have two more pages pageC and pageD and you can navigate from pageA to pageB to pageC to pageD using some next button on each page. Now, suppose you have created a bounded task flow using pageA, pageB and pageC. So, if your bean is of pageFlowScope then after selecting a value in list at pageA if you navigate till pageC, you can still access the bean's property. It persists within the taskflow boundries. But, if you navigate to pageD then the bean will be destriyed. pageFlowScope is kinda more broader than requestScope and smaller than a session scope. For most of the scenarios in ADF you create a bounded task flow to implement a business use case. So, in way pageFlowScope makes more sense than a session scope. Ofcourse, session will be required in cases where you need to persis the values out of a taskflow boundry. You can access it using an EL expression like #{pageFlowScope.YourBean.yourPropertyName}.


4. sessionScope: Continuing with the same example, the bean once instantiated will persist till the entire user session. This session usually persists till a user is logged in. Usually, web servers are configured for a session time out property which makes the session invalid after the specified period of time. So, the bean's property can be access anywhere for that session. Usually, in real life scenarios information related to user like its profile are set in to the sessions.


5. applicationScope: As the name suggests this scope persists as long as the application is running. Ususally, application scope parameters are initialized at the time of application start-up (web server start). Generally, some all time needed resources are initialized using applicationScope which are required all the time and are independent of any specific role or responsibility.

6.View Scope: It Stores objects uaed by a Single Page and retains the objects as long as the user continues to interect with the page, and then automaticaly releases them when the user leaves the page.

7. PageFlow Scope : It makes it easier to pass values from one page to another within a taskflow. This Scopes means that the bean is available for a set of pages in the current taskflow

8. BackingBean Scopes:  It is uased for managed beans for page fragements and declarative components only

Wednesday, February 4, 2009

11G : How to Create ADF Business Component ?

Steps for creation of ADF Business Component(BC) in JDeveloper 11.1.1 ::

Step-1 : Create New Application.


Step-2 : Right click on Model and select NEW from the Context menu.


Step-3 : In categories, select Business Tier > ADF Business Component







Step-4 : Select Business_Component_from_table from Item.





Step-5 : Click OK.


Step-6 : put the package(optional, ex, neelmani.model.entities). (This window is for Entity_Object)






Step-7 : select required Schema(ex, Hr)


Step-8 : Check on auto_query.


Step-9 : select table from AVAILABLE and sattle it to SELECTED.


Step-10: click NEXT.


Step-11: put value for model(optional, ex, neelmani.model.queries). (This window is for Updatable_View_Object)





Step-12: select object from AVAILABLE and sattle it to SELECTED.


Step-13: Click NEXT.


Step-14: Now Select Object from AVAILABLE and sattle it into SELECTED. (This window is for Read_Only_Object)


Step-15: click NEXT.


Step-16: Check Application_Module. put Package(ex, neelmani.model.queries) put Name(Ex, NeelmaniModule)






Step-17: Click Finish.

11G : How to create Application Server Connection ?

Steps for Create New Application Server Connection in Jdeveloper 11.1.1 ::

Step-1 : open Application_Server_Navigator(view > Application_Server_Navigator)

Step-2 : select application_server Node

Step-3 : Right click and select new_Application_server from context menu.


Step-4 : Put the connection name(ex, NeelmaniAS).
Slect Connection_type(ex, WebLogic 10.3)
Click OK.


Step-5 : put userName and Password(weblogic userName and Password). Check Deployed_Password.

Step-6 : put weblogic_host_name(Administrator server, default- Localhost)
put port,SSL_port
put WSL_Domain (Ex, Neelmani_Domain)



Step-7 : Test Connection.


Step-8 : Click OK.

Video for 11G : How to Create Database Connection ?

Steps for Creation of Database Connection in JDeveloper 11.1.1 ::



Step-1 : Goto Database Navigator(View > Database Navigator).






Step-2 : select the Application.




Step-3 : Right Click and select New Connection from Context menu.







Step-4 : Put the Details:


Put the Connection Name(ex, NeelmaniConn)
select Connection Type(ex, Oracle(JDBC))
put userName(schema_name) and Password(schema_password).
you can leave Role and
check Deploy_password.
put Driver(ex, thin),
put HostName(ex, Localhost)
put Jdbc port(ex, 1521)
put SID name(ex, XE/ORCL)








Step-5 : Click on Test_Connection.


Step-6 : Click OK

~: Video for Database Connection in Jdeveloper 10.1.3 :~

Video for 11G : How to Create an Application ?

How to Create an Application In JDeveloper 11.1.1 ?

Step-1 : Goto FILE > NEW





Step-2 : GotO General > Application





Step-3 : select Required Application type from Item

Step-4 : Click OK


~: Video For Creation of Application in Jdeveloper 11.1.1.0.1 G :~


11G : How to Start Jdeveloper 11.1.1 ?

How to start the JDeveloper 11.1.1?

1> Install Oracle JDeveloper 11g.


2> Start > All Programs > Oracle Fusion Middleware > Jdeveloper Studio 11.1.1




3> Select the Required Role from the Dialog popup(If it ask).





4> Click OK.





5> Jdeveloper is Open Now



11G : How to Upload a File ?

File Uploading in Jdeveloper 11g::

Step-1 : use UI Component(InputFile Component) on the Jsp pages.

Step-2 : Update WEB-INF
Step-3 : update FORM ()


Step-4 : Create Value-Change-Listner & set the value to UiComponent



Step-5 : Bind the value to ManagedBean


Step-6 : Write the code for ManagedBean:


Tuesday, February 3, 2009

10G : How To Create Search and Results on the Same Page

Step-1 : To create a page that has both a search form and results table on the same page, you follow the procedures for when they are on separate pages, except you must create a separate iterator for the results table.

Step-2 : To create a search form and results table on the same page:

Step-3 :From the Data Control Palette, drag a collection and from the context menu, select Forms > ADF Search Form.For example, if you want the query to execute over all service requests, you would drag the ServiceRequests collection.

Step-4 : Drag the same collection, but this time drop it as any type of table.

Step-5 : Open the associated page definition file.

Step-6 : In the Structure Pane, right-click on the Executables node and choose Insert inside
executables > invokeAction.

Step-7 : In the Insert invokeAction dialog, enter an ID for the action, such as AlwaysFind. From the Binds drop-down list, select Find. Do NOT click OK or close the dialog.

Step-8 : In the Insert invokeAction dialog, select the Advanced Properties tab.

Step-9 : For RefreshCondition, enter the following EL expression, which tells the application to invoke this action whenever the page is not in Find mode. Replace with the name of the iterator:${bindings..findMode == false}Note:The invokeAction must appear before the iterator, so that it is executed first.

Step-10 : In the Structure Pane, right-click on the Executables node and choose Insert inside executables > iterator.

Step-11 : Select the same collection used for the search form, and in the Iterator ID field enter a more meaningful name, such as ResultsIterator and click OK.

Step-12 : In the Structure Pane, expand the bindings node, right-click on the binding for the results table, and choose Properties.

Step-13 : In the Table Binding Editor dialog, make sure the correct collection is selected in the Data Collection column.

Step-14 : Select the newly created iterator from the Iterator drop-down list, ensure that all correct attributes are in the Display Attributes column, and click OK.

Step-15 : In the JSF page, delete the Find button.

Step-16 : Doing this only deletes the component from the JSF page। The binding still exists in the page definition file.

Sunday, September 7, 2008

JSF an Introduction

What is JSF?

A server side user interface component framework for Java™ technology-based web applications.JavaServer Faces (JSF) is an industry standard and a framework for building component-based user interfaces for web applications. JSF contains an API for representing UI components and managing their state; handling events, server-side validation, and data conversion; defining page navigation; supporting internationalization and accessibility; and providing extensibility for all these features.

what are the advantage of JSF?

The major benefits of JavaServer Faces technology are:
JavaServer Faces architecture makes it easy for the developers to use. In JavaServer Faces technology, user interfaces can be created easily with its built-in UI component library, which handles most of the complexities of user interface management.
Offers a clean separation between behavior and presentation.
Provides a rich architecture for managing component state, processing component data, validating user input, and handling events.
Robust event handling mechanism.
Events easily tied to server-side code.
Render kit support for different clients
Component-level control over statefulness
Highly 'pluggable' - components, view handler, etc
JSF also supports internationalization and accessibility
Offers multiple, standardized vendor implementations

What is the difference between JSF and Struts?

In a nutshell, Faces has the following advantages over Struts:
Eliminated the need for a Form Bean
Eliminated the need for a DTO Class
Allows the use of the same POJO on all Tiers because of the Backing Bean

The primary advantages of Struts as compared to JavaServer Faces technology are as follows:
Because Struts is a web application framework, it has a more sophisticated controller architecture than does JavaServer Faces technology. It is more sophisticated partly because the application developer can access the controller by creating an Action object that can integrate with the controller, whereas JavaServer Faces technology does not allow access to the controller. In addition, the Struts controller can do things like access control on each Action based on user roles. This functionality is not provided by JavaServer Faces technology.
Struts includes a powerful layout management framework, called Tiles, which allows you to create templates that you can reuse across multiple pages, thus enabling you to establish an overall look-and-feel for an application.
The Struts validation framework includes a larger set of standard validators, which automatically generate both server-side and client-side validation code based on a set of rules in a configuration file. You can also create custom validators and easily include them in your application by adding definitions of them in your configuration file.

The greatest advantage that JavaServer Faces technology has over Struts is its flexible, extensible UI component model, which includes:
A standard component API for specifying the state and behavior of a wide range of components, including simple components, such as input fields, and more complex components, such as scrollable data tables. Developers can also create their own components based on these APIs, and many third parties have already done so and have made their component libraries publicly available.
A separate rendering model that defines how to render the components in various ways. For example, a component used for selecting an item from a list can be rendered as a menu or a set of radio buttons.
An event and listener model that defines how to handle events generated by activating a component, such as what to do when a user clicks a button.
Conversion and validation models for converting and validating component data.

what are Available Implementation of JSF?

The main implementations of JavaServer Faces are:
Reference Implementation (RI) by Sun Microsystems.
Apache MyFaces is an open source JavaServer Faces (JSF) implementation or run-time.
ADF Faces is Oracle’s implementation for the JSF standard.

what a typical JSF application contains?


A typical JSF application consists of the following parts:
JavaBeans components for managing application state and behavior.
Event-driven development (via listeners as in traditional GUI development).
Pages that represent MVC-style views; pages reference view roots via the JSF component tree.


7. What Is a JavaServer Faces Application?
JavaServer Faces applications are just like any other Java web application. They run in a servlet container, and they typically contain the following:
JavaBeans components containing application-specific functionality and data.
Event listeners.
Pages, such as JSP pages.
Server-side helper classes, such as database access beans.
In addition to these items, a JavaServer Faces application also has:

A custom tag library for rendering UI components on a page.
A custom tag library for representing event handlers, validators, and other actions.
UI components represented as stateful objects on the server.
Backing beans, which define properties and functions for UI components.
Validators, converters, event listeners, and event handlers.
An application configuration resource file for configuring application resources.


8. What is Managed Bean?


JavaBean objects managed by a JSF implementation are called managed beans. A managed bean describes how a bean is created and managed. It has nothing to do with the bean's functionalities.

9. What is Backing Bean?
Backing beans are JavaBeans components associated with UI components used in a page. Backing-bean management separates the definition of UI component objects from objects that perform application-specific processing and hold data.

The backing bean defines properties and handling-logics associated with the UI components used on the page. Each backing-bean property is bound to either a component instance or its value. A backing bean also defines a set of methods that perform functions for the component, such as validating the component's data, handling events that the component fires and performing processing associated with navigation when the component activates.

10. What are the differences between a Backing Bean and Managed Bean?


Backing Beans are merely a convention, a subtype of JSF Managed Beans which have a very particular purpose. There is nothing special in a Backing Bean that makes it different from any other managed bean apart from its usage.

What makes a Backing Bean is the relationship it has with a JSF page; it acts as a place to put component references and Event code.

Backing Beans
Managed Beans
A backing bean is any bean that is referenced by a form.
A managed bean is a backing bean that has been registered with JSF (in faces-config.xml) and it automatically created (and optionally initialized) by JSF when it is needed.

The advantage of managed beans is that the JSF framework will automatically create these beans, optionally initialize them with parameters you specify in faces-config.xml,
Backing Beans should be defined only in the request scope
The managed beans that are created by JSF can be stored within the request, session, or application scopes

Backing Beans should be defined in the request scope, exist in a one-to-one relationship with a particular page and hold all of the page specific event handling code.In a real-world scenario, several pages may need to share the same backing bean behind the scenes.A backing bean not only contains view data, but also behavior related to that data.

11. What is view object?

A view object is a model object used specifically in the presentation tier. It contains the data that must display in the view layer and the logic to validate user input, handle events, and interact with the business-logic tier. The backing bean is the view object in a JSF-based application. Backing bean and view object are interchangeable terms.



12. What is domain object model?

Domain object model is about the business object and should belong in the business-logic tier. It contains the business data and business logic associated with the specific business object.

13. What is the difference between the domain object model and a view object?

In a simple Web application, a domain object model can be used across all tiers, however, in a more complex Web application, a separate view object model needs to be used. Domain object model is about the business object and should belong in the business-logic tier. It contains the business data and business logic associated with the specific business object. A view object contains presentation-specific data and behavior. It contains data and logic specific to the presentation tier.

14. What do you mean by Bean Scope?


Bean Scope typically holds beans and other objects that need to be available in the different components of a web application.

15. What are the different kinds of Bean Scopes in JSF?


JSF supports three Bean Scopes. viz.,
Request Scope: The request scope is short-lived. It starts when an HTTP request is submitted and ends when the response is sent back to the client.
Session Scope: The session scope persists from the time that a session is established until session termination.
Application Scope: The application scope persists for the entire duration of the web application. This scope is shared among all the requests and sessions.


16. What is the difference between JSP-EL and JSF-EL?
JSP-EL
JSF-EL
In JSP-EL the value expressions are delimited by ${…}.
In JSf-EL the value expressions are delimited by #{…}.
The ${…} delimiter denotes the immediate evaluation of the expressions, at the time that the application server processes the page.
The #{…} delimiter denotes deferred evaluation. With deferred evaluation ,the application server retains the expression and evaluates it whenever a value is needed.
note:As of JSF 1.2 and JSP 2.1 ,the syntax of both expression languages has been unified.


17. What are The main tags in JSF?


JSF application typically uses JSP pages to represent views. JSF provides useful special tags to enhance these views. Each tag gives rise to an associated component. JSF (Sun Implementation) provides 43 tags in two standard JSF tag libraries:
JSF Core Tags Library.
JSF Html Tags Library.


18. How do you declare the managed beans in the faces-config.xml file?


The bean instance is configured in the faces-config.xml file:

login com.developersBookJsf.loginBean request

This means: Construct an object of the class com.developersBookJsf.loginBean, give it the name login, and keep it alive for the duration of the request.

19. How to declare the Message Bundle in JSF?


We can declare the message bundle in two ways: (Let’s assume com.developersBookJsf.messages is the properties file)
1. The simplest way is to include the following elements in faces-config.xml file:
com.developersBookJsf.messages message
2. Alternatively, you can add the f:loadBundle element to each JSF page that needs access to the bundle:


20. How to declare the page navigation (navigation rules) in faces-config.xml file ?


Navigation rules tells JSF implementation which page to send back to the browser after a form has been submitted. We can declare the page navigation as follows:

/index.jsp login /welcome.jsp
This declaration states that the login action navigates to /welcome.jsp, if it occurred inside /index.jsp.

21. What if no navigation rule matches a given action?


If no navigation rule matches a given action, then the current page is redisplayed.



22. What are the JSF life-cycle phases?


The six phases of the JSF application lifecycle are as follows (note the event processing at each phase):
1. Restore view 2. Apply request values; process events 3. Process validations; process events 4. Update model values; process events5. Invoke application; process events6. Render response

23. Explain briefly the life-cycle phases of JSF?


1. Restore View : A request comes through the FacesServlet controller. The controller examines the request and extracts the view ID, which is determined by the name of the JSP page. 2. Apply request values: The purpose of the apply request values phase is for each component to retrieve its current state. The components must first be retrieved or created from the FacesContext object, followed by their values. 3. Process validations: In this phase, each component will have its values validated against the application's validation rules. 4. Update model values: In this phase JSF updates the actual values of the server-side model ,by updating the properties of your backing beans.5. Invoke application: In this phase the JSF controller invokes the application to handle Form submissions.6. Render response: In this phase JSF displays the view with all of its components in their current state.


24. What does it mean by render kit in JSF?


A render kit defines how component classes map to component tags that are appropriate for a particular client. The JavaServer Faces implementation includes a standard HTML render kit for rendering to an HTML client.

25. Is it possible to have more than one Faces Configuration file?
We can have any number of config files. Just need to register in web.xml. Assume

that we want to use faces-config(1,2,and 3),to register more than one faces configuration file in JSF,just declare in the web.xml file
javax.faces.CONFIG_FILES /WEB-INF/faces-config1.xml, /WEB-INF/faces-config2.xml, /WEB-INF/faces-config3.xml

DataBase an Introduction

What is SQL?

SQL stands for 'Structured Query Language'.


What is SELECT statement?

The SELECT statement lets you select a set of values from a table in a database. The values selected from the database table would depend on the various conditions that are specified in the SQL query.


How can you compare a part of the name rather than the entire name?

SELECT * FROM people WHERE empname LIKE '%ab%'Would return a recordset with records consisting empname the sequence 'ab' in empname .


What is the INSERT statement?

The INSERT statement lets you insert information into a database.



How do you delete a record from a database?

Use the DELETE statement to remove records or any particular column values from a database.


How could I get distinct entries from a table?

The SELECT statement in conjunction with DISTINCT lets you select a set of distinct values from a table in a database. The values selected from the database table would of course depend on the various conditions that are specified in the SQL query. ExampleSELECT DISTINCT empname FROM emptable


How to get the results of a Query sorted in any order?

You can sort the results and return the sorted results to your program by using ORDER BY keyword thus saving you the pain of carrying out the sorting yourself. The ORDER BY keyword is used for sorting.SELECT empname, age, city FROM emptable ORDER BY empname



How can I find the total number of records in a table?

You could use the COUNT keyword , exampleSELECT COUNT(*) FROM emp WHERE age>40



What is GROUP BY?

The GROUP BY keywords have been added to SQL because aggregate functions (like SUM) return the aggregate of all column values every time they are called. Without the GROUP BY functionality, finding the sum for each individual group of column values was not possible.



What is the difference among "dropping a table", "truncating a table" and "deleting all records" from a table.

Dropping : (Table structure + Data are deleted), Invalidates the dependent objects ,Drops the indexes
Truncating: (Data alone deleted), Performs an automatic commit, Faster than delete
Delete : (Data alone deleted), Doesn’t perform automatic commit



What are the Large object types suported by Oracle?

Blob and Clob.



Difference between a "where" clause and a "having" clause.

Having clause is used only with group functions whereas Where is not used with.



What's the difference between a primary key and a unique key?

Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only.



What are cursors? Explain different types of cursors. What are the disadvantages of cursors? How can you avoid cursors?

Cursors allow row-by-row prcessing of the resultsets.
Types of cursors: Static, Dynamic, Forward-only, Keyset-driven. See books online for more information.
Disadvantages of cursors: Each time you fetch a row from the cursor, it results in a network roundtrip, where as a normal SELECT query makes only one rowundtrip, however large the resultset is. Cursors are also costly because they require more resources and temporary storage (results in more IO operations). Furthere, there are restrictions on the SELECT statements that can be used with some types of cursors.
Most of the times, set based operations can be used instead of cursors.



What are triggers? How to invoke a trigger on demand?

Triggers are special kind of stored procedures that get executed automatically when an INSERT, UPDATE or DELETE operation takes place on a table.
Triggers can't be invoked on demand. They get triggered only when an associated action (INSERT, UPDATE, DELETE) happens on the table on which they are defined.
Triggers are generally used to implement business rules, auditing. Triggers can also be used to extend the referential integrity checks, but wherever possible, use constraints for this purpose, instead of triggers, as constraints are much faster.


What is a join and explain different types of joins.

Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table.
Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.



What is a self join?

Self join is just like any other join, except that two instances of the same table will be joined in the query.



What is Function?

SQL functions are built into Oracle Database and are available for use in various appropriate SQL statements

Store Procedure: CREATE OR REPLACE PROCEDURE DELETECUSTOMER
(MyCustomerID IN NUMBER) IS
BEGIN
Delete From Customer Where CustomerID = MyCustomerID;
End DeleteCustomer;


Trigger: Define procedures called triggers that run implicitly when an INSERT, UPDATE, or DELETE statement is issued against the associated table or, in some cases.

Package: Packages provide a method of encapsulating related procedures, functions, and associated cursors and variables together as a unit in the database.
It allows you to group together related items.

View: A view is a logical entity.
CREATE OR REPLACE VIEW ASSELECT FROM ;

Cursor: When a query is executed in oracle, a result set is produced and stored in the memory. Oracle allows the programmer to access this result set in the memory through cursors.
1. %FOUND2. %ISOPEN3. %NOTFOUND4. %ROWCOUNT

Index: An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each value that appears in the indexed columns. By default, Oracle creates B-tree indexes.
CREATE [UNIQUE] INDEX index_name ON table_name (column1, column2, . column_n) [ COMPUTE STATISTICS ];

Application Server Vs Web Server

What is the difference between Web Server and Application server?

I would like to answer the question.. Thats really a good question in which every programmer/developer is supposed to (should) know.

Difference between AppServer and a Web server

(1) Webserver serves pages for viewing in web browser, application server provides exposes businness logic for client applications through various protocols.

(2) Webserver exclusively handles http requests.application server serves bussiness logic to application programs through any number of protocols.

(3) Webserver delegation model is fairly simple,when the request comes into the webserver,it simply passes the request to the program best able to handle it(Server side program). It may not support transactions and database connection pooling.

(4) Application server is more capable of dynamic behaviour than webserver. We can also configure application server to work as a webserver.Simply applic! ation server is a superset of webserver.

Web Server serves static HTML pages or gifs, jpegs, etc., and can also run code written in CGI, JSP etc. A Web server handles the HTTP protocol. Eg of some web server are IIS or apache.
An Application Server is used to run business logic or dynamically generated presentation code. It can either be .NET based or J2EE based (BEA WebLogic Server, IBM WebSphere, JBoss).
A J2EE application server runs servlets and JSPs (infact a part of the app server called web container is responsible for running servlets and JSPs) that are used to create HTML pages dynamically. In addition, J2EE application server can run EJBs - which are used to execute business logic.

An Application server has a 'built-in' web server, in addition to that it supports other modules or features like e-business integration, independent management and security module, portlets etc

ETC




NOT YET DOCUMENTED:


    public boolean isNumber(String num) {
        boolean flag = true;
        try {
            int spaceIndx = num.indexOf(" ");
            if (spaceIndx != -1) {
                flag = false;
            } else {
                Number n = new Number(num);
                if (n.doubleValue() <= 0.0) {
                    flag = false;
                }
            }
        } catch (Exception e) {
            flag = false;
        }
        return flag;
    }


-------------------------------------

       public String getEmpName(){
           Connection con = null;
           Statement stmt = null;
           ResultSet rs = null;
           String fName = null;
           try {
               con = ConnectionConn.getConnection();
               stmt = con.createStatement();
               String query = "Select First_Name from EMPLOYEES where EMPLOYEES_ID= '100'";
               rs = stmt.executeQuery(query);
               while(rs.next()){
                   fName = rs.getString("first_Name");
               }
           }
           catch(Exception e){
               e.printStackTrace();
           }
           finally{
               Utils.close(rs,stmt,con);
           }
           return fName;
       }

---------------------------------------

value="#{row.status != 111?'OPEN':''}"

value="#{bindings.status.inputValue == 'Active'? 'Yes' : 'No'}"

--------------------------------------


public class IndexBean {
    private RichTable empTable;
    private List selectedEmpArray = new ArrayList();
    private int modifiedRows = 0;
    private int newRows = 0;

   

    public void setModifiedRows(int modifiedRows) {
        this.modifiedRows = modifiedRows;
    }

    public int getModifiedRows() {
        return modifiedRows;
    }

    public void setNewRows(int newRows) {
        this.newRows = newRows;
    }

    public int getNewRows() {
        return newRows;
    }

    /**  RICH TABLE's SELECTION LISTENER
     * Get the selected rowKey
     * Add the rowKey to selectedEmpArray arrayList
     * @param selectionEvent
     */
    public void empSelectionEvent(SelectionEvent selectionEvent) {
        RowKeySet empRKS = selectionEvent.getAddedSet();
        if (empRKS.size() > 0) {
            Iterator empRKSIterator = empRKS.iterator();
            while (empRKSIterator.hasNext()) {
                Key key = (Key)((List)empRKSIterator.next()).get(0);
                if (!selectedEmpArray.contains(key)) {
                    selectedEmpArray.add(key);
                }
            }
        }
    }

    public BindingContainer getBindings() {
        return BindingContext.getCurrent().getCurrentBindingsEntry();
    }

    /** COMMANDBUTTON COMMIT's ACTION LISTENER
     * While loop the selectedEmpArray
     * Get the entity status for the rowKeys
     * @param actionEvent
     */
    public void fetchModifiedRows(ActionEvent actionEvent) {
        if (selectedEmpArray.size() > 0) {
            //Resetting the row counts
            this.setModifiedRows(0);
            this.setNewRows(0);

            DCBindingContainer dcBindings = (DCBindingContainer)getBindings();
            DCIteratorBinding EmpsDCIterBinding = dcBindings.findIteratorBinding("EmployeesView1Iterator");
            RowSetIterator EmpsRSIter = EmpsDCIterBinding.getRowSetIterator();
            ViewObject vo = EmpsDCIterBinding.getViewObject();

            Iterator selectedEmpsIter = selectedEmpArray.iterator();
            while (selectedEmpsIter.hasNext()) {
                Row currentRow = EmpsRSIter.getRow((Key)selectedEmpsIter.next());
                EmpsRSIter.setCurrentRow(currentRow);

                ViewRowImpl myRow = (ViewRowImpl)vo.getCurrentRow();
                EntityImpl entityImpl = (EntityImpl)myRow.getEntity(0);
                if (EntityImpl.STATUS_MODIFIED == entityImpl.getEntityState()) {
                    this.setModifiedRows((this.getModifiedRows() + 1));
                } else if (EntityImpl.STATUS_NEW == entityImpl.getEntityState()) {
                    this.setNewRows((this.getNewRows() + 1));
                }
            }
        }
        commitAction();
    }

    /** CREATE BUTTON's ACTION LISTENER
     * CreateInsert new row and get rowKey for the added row
     * Add the rowKey to the selectedEmpArray arrayList
     * @param actionEvent
     */
    public void createNewRow(ActionEvent actionEvent) {
        BindingContainer bindings = getBindings();
        OperationBinding oper = bindings.getOperationBinding("CreateInsert");
        oper.execute();

        DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding EmpsIter = dcBindings.findIteratorBinding("EmployeesView1Iterator");
        EmployeesViewImpl eImpl = (EmployeesViewImpl)EmpsIter.getViewObject();
        if (!selectedEmpArray.contains(eImpl.getCurrentRow().getKey())) {
            selectedEmpArray.add(eImpl.getCurrentRow().getKey());
        }
    }

    public String commitAction() {
        BindingContainer bindings = getBindings();
        OperationBinding operationBinding = bindings.getOperationBinding("Commit");
        Object result = operationBinding.execute();
        if (!operationBinding.getErrors().isEmpty()) {
            return null;
        }
        return null;
    }


}

------------------------------
  public String search(){

    String uName= null;
    FacesContext fctx = null;

    if(this.getInputText01().getValue() != null){
     
      uName = this.getInputText01().getValue().toString();
      }
      fctx = FacesContext.getCurrentInstance();
      ValueBinding userBrBind =
          fctx.getApplication().createValueBinding("#{bindings.VO1Iterator}");
      DCIteratorBinding userIter =
          (DCIteratorBinding)userBrBind.getValue(fctx);
      userIter.getViewObject().setNamedWhereClauseParam("uName",
                                                          uName);
      userIter.getViewObject().setWhereClause(null);
      userIter.executeQuery();
     
    this.getTable1().setRendered(true);
    return null;
    }
---
vBind = facesContext.getApplication().createValueBinding("#{bindings.EmployeesVO1Iterator}");
empIter = (DCIteratorBinding)vBind.getValue(facesContext);
empIter.getViewObject().setWhereClause(null);
empIter.executeQuery();
empIter.getViewObject().setWhereClause(" ( QRSLT.IS_DEL = 'Y' or QRSLT.IS_CENTER = 'Y' )and upper(QRSLT.BR) like upper ('%' ||'"+fromBr+"'"+" || '%')");
empIter.getViewObject().setOrderByClause("upper(QRSLT.BR)");
empIter.executeQuery();
    
-------------------------------
NOTE: Some times afterPhase() and beforePhase() will get executed multiple times. How to restrict them?
Solution:
    public void beforePhase(PhaseEvent phaseEvent){
      
        if(phaseEvent.getPhaseId().toString().equalsIgnoreCase("RENDER_RESPONSE 6")){

            onPageLoad();
           
            }
       
        }
   
    public void onPageLoad(){
        System.out.println("onPageLoad");
        }
-------------------------------Handling DC based on Bean---------
private String name;
private NUMBER age;
private boolean vehicle;
private ArrayList productDtls;

------------
Attribute Name="name" Type="java.lang.String"
Attribute Name="age" Type="oracle.sql.NUMBER"/
Attribute Name="vehicle" Type="boolean"/

AccessorAttribute id="productDtls" IsCollection="true" Type="java.util.ArrayList"
                     CollectionBeanClass="UpdateableCollection"
                     BeanClass="com.mb.test.productDtls"

------------

FacesContext fctx = FacesContext.getCurrentInstance();
Application appl = fctx.getApplication();
DCBindingContainer bindings =
                (DCBindingContainer)appl.getVariableResolver().resolveVariable(fctx,
                                                                               "bindings");
neelmaniDataMBean wMBean =
                (neelmaniDataMBean)bindings.getBindingContext().findDataControl("neelmaniDataMBean").getDataProvider();
---
                 VariableResolver varResol = null;
                 varResol = appl.getVariableResolver();
                 NeelmaniCustInfoBean neelInfo =   (NeelmaniBean)varResol.resolveVariable(fctx,  "backing_pages_customerInfo");
                
                 neelInfo.getInputText1().setDefaultFacet("def");

-----Array List type Attribute in Bean Based DC

accessorIterator id="productDtlsIterator" RangeSize="-1" Binds="productDtls"
                      DataControl="NeelmaniDataMBean"
                      BeanClass="com.mb.test.NeelproductDtlsDtls"
                      MasterBinding="neelmaniDataMBean_dataProvider_rootIter"

-
JUFormBinding pkgs =
                    (JUFormBinding)appl.createValueBinding("#{bindings}").getValue(fctx);
DCIteratorBinding pkgsIter = pkgs.findIteratorBinding("productDtlsIterator");

-------------------------------
import oracle.jbo.server.DBTransaction;
PreparedStatement stmt = null;

DBTransaction transaction = (DBTransaction)am.getTransaction();
stmt = transaction.createPreparedStatement("",1);
stmt.executeUpdate();
               
transaction.getTransaction().commit();
transaction.getTransaction().setClearCacheOnCommit(true);
transaction.clearVOCaches("testEO", true);
transaction.clearVOCaches("testEO", true);
--
DBTransaction transaction = (DBTransaction)am.getTransaction();
String query = "select age from employees where age = (?) and dept_id = (?)";
pSmt = dbTrans.createPreparedStatement(query,1);
pSmt.setString(1,"30");
pSmt.setString(2,"11");
ResultSet result = pSmt.executeQuery();
-------------------------------
    public static ApplicationModuleImpl getAMInstance(String AM) {
         
            FacesContext fc = FacesContext.getCurrentInstance();
            Application app = fc.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();
            ELContext elContext = fc.getELContext();
            ValueExpression valueExp =
                elFactory.createValueExpression(elContext, "#{data."+AM+"DataControl.dataProvider}",
                                                Object.class);

            return (ApplicationModuleImpl)valueExp.getValue(elContext);
      
    }
-------------------------------
Jasper report tutorial
-------------------------------
BI Report Integration with ADF
-------------------------------

 

 

 

 

    private Date getOneDayLessThanCurrentDate(){
        // Initializing variables.
        Timestamp ts = null;
        try {
            // Get the Calendar instance.
            Calendar calendar = Calendar.getInstance();
            // Set the date that is to be used as reference.
            calendar.setTime(new java.util.Date());
            // Subtract the reference date by 1.
            calendar.add(Calendar.DAY_OF_MONTH, -1);
            // Set the time factor to 0. Only the date is required.
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            calendar.set(Calendar.MILLISECOND, 0);
            // Get the new date.
            java.util.Date jDt = calendar.getTime();
            ts = new Timestamp(jDt.getTime());           
           
        }
        catch (Exception e) {
            logger.severe(" Error - getOneDayLessThanCurrentDate() ", e);
        }finally{
            // Return the newly prepared date.
            return new Date(ts);   
        }
    }

---
(new oracle.jbo.server.SequenceImpl("DEPT_SEQ", adf.object.getDBTransaction())).getSequenceNumber() as String

---
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adf-naming-layout-guidelines-v2-00-1904828.pdf

----

#{requestScope['attributeKey']}

when "attributeKey" is the attribute having "."

------------------------------------
Copyright \u00a9
Resource bundle entry for Copyright symbol
___________________________
LoggedInUser---
String logedInUser = ((AppModuleImpl) getDBTransaction().getRootApplicationModule()).getUserPrincipalName();
if(){
logedInUser = "anonymous";
}
return logedInUser;

--------------------------------------

Post Changes

____________________________
To disable JAAS :
Edit adf-config.xml file

Set [authorizationEnforce="false" authenticationRequire="false"] for JaasSecurityContext
____________________________
Getting handle of Resource bundle programatically

 FacesContext fc = FacesContext.getCurrentInstance();
        ResourceBundle bundle = fc.getApplication().getResourceBundle(fc,"bundle_name");
        bundle.getString("resource_identifier");

__________________________________
af:goLink text=”#{row.EmailAddress}”
destination=”#{\”mailto:\”} #{row.EmailAddress}”
_____________________________

how to pass the arguments within JDeveloper:

Tools > Project Properties > Run/Debug > Edit Default Run Configuration (or create new one) > Launch Settings > Program Arguments - here you can put in arguments

-------------------------------------------- 
http://oracleadf-java.blogspot.in/2012/10/passing-parameter-in-xml-resource-and.html
---------------- 
 Refresh Whole Page Programatically---
    protected void refreshPage() {
    FacesContext fctx = FacesContext.getCurrentInstance();
    String refreshpage = fctx.getViewRoot().getViewId();
    ViewHandler ViewH = fctx.getApplication().getViewHandler();
    UIViewRoot UIV = ViewH.createView(fctx, refreshpage);
    UIV.setViewId(refreshpage);
    fctx.setViewRoot(UIV);
    }


---------------------------------- 


 "Low memory warning" on JDeveloper .


 There are two config files on jdeveloper installation directory.
the first one is jdev.conf file. the file located in \jdeveloper\jdev\bin
increase the memory values for the following parameters:
AddVMOption -XX:MaxPermSize=1024M

the second one is ide.conf file on \jdeveloper\ide\bin.

AddVMOption -Xmx1024M
AddVMOption -Xms1024M


---------------------------------------------------