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


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