How to get URL parameter values in backing bean?
Thursday, September 11, 2008
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("param name"));
How to avoid JBO-35007 error?
When row currency validation fails JBO-35007 error is reaised.
Row currency validation safe gaurds ADF application from browser back button issue.
What is browser back button issue?
Form Duncan Mills ""Oracle JDeveloper 10g for Forms and PL/SQL Developers" book :
Users may be accustomed to clicking the browser's Back button to return to the preceding page or the Refresh button to reload the page. This can cause problems with web applications that use a Controller layer, like the JSF controller or Struts, because the browser Back button returns to the preceding page in the browser's page history without calling code in the Controller layer. The controller will therefore, not know the state of the application's data and the preceding page will either not load properly or may place the application into an inconsistent or unstable state. The same problem occurs with the browser's Refresh button, which just reloads the same page, again without calling Controller layer code. This is a problem in all web applications, not only those using J2EE technology or ADF libraries.
How to ignore row currnecy validation?
There are two ways to avoid this validation.(Note: As Row currency validation safe gaurds ADF application from browser back button issue, it is not suggested to ignore row currency validation)
Method I
Set the EnableTokenValidation to false in the page definition file.
1)In the Application Navigator, right-click the JSP page for which you want to disable validation, and choose Go to Pa ge Definition.
2)In the Structure window, right-click the pagenamePageDef node and choose Properties from the context menu.
3)In the PageDef Properties dialog, select the Advanced Properties tab.
4)In the Enable Token Validation box and choose False. The EnableTokenValidation attribute is added to the PageDef.xml file namespace with a value of false.
Method II
Disable row currency validation on an iterator by setting the "StateValidation" property of an iterator to "false" without disabling it for all iterators in the page definition.
How you can access the true value of the selected list item or radio button directly from ADF
Friday, July 25, 2008
ADF manages the selected value of the list item internally and the value that is exposed through the list binding itself is only the index number of the selection in the list. Developers often make the mistake of treating the value of the list binding as one of these expected values and trying to write code or expressions based on that. The simplest way to gain direct access to the true value of an attribute that is populated from a list binding is to create a secondary value binding to the underlying data. This secondary binding can then be used within expressions to access the true value of the attribute.
Details can be found here.
How to override the sort behavior of table column
Wednesday, July 23, 2008
Add following code to managed bean that is accessed from the table's sort listener. In this example, whenever users try to sort on the DepartmentName by clicking onto the table header, the sort criteria is modified to DepartmentId .
import java.util.ArrayList;
import java.util.List;
import oracle.adf.view.faces.component.core.data.CoreTable;
import oracle.adf.view.faces.event.SortEvent;
import oracle.adf.view.faces.model.SortCriterion;
public class Sortbean {
public Sortbean() {
}
public void onSort(SortEvent sortEvent) {
List sortList = sortEvent.getSortCriteria();
SortCriterion sc = (SortCriterion) sortList.get(0);
//override sort by DepartmentName and make it sort by DepartmentId instead
if (((String)sc.getProperty()).equalsIgnoreCase("DepartmentName")){
System.out.println("You wanted to sort " +sc.getProperty());
sortList = new ArrayList();
SortCriterion sc2 = new SortCriterion("DepartmentId",true);
System.out.println("This is what I want you to sort for "+sc2.getProperty());
sortList.add(sc2);
CoreTable ct = (CoreTable)sortEvent.getComponent();
ct.setSortCriteria(sortList);
}
}
}
Refreshing Table after Inline Delete
To refresh a table data after inline delete, add the following code after delete logic in managed bean.
AdfFacesContext.getCurrentInstance().addPartialTarget(TableId)
How to get Reference of one Managed Bean from other Managed Bean
Monday, June 30, 2008
Read more...FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
MyManagedBeanClass mb = (MyManagedBeanClass) app.getVariableResolver().resolveVariable(ctx,"MyManagedBean");
How to Implement Dependent Drop Down List in ADF
Thursday, May 15, 2008
In this How-to example, I am going to explain, how dependent drop down list can be implemented in ADF.
Here I am creating two drop down lists "Department" and "Employee".
On selecting department, the list of employees will change.
I am assuming that you have sample HR schema installed in your database.
Create View Object DepartmentListVO for Department SelectItems.
Query: Select department_id, department_name from departments
Create View Object EmployeeListVO for Employee SelectItems.
Query: select employee_id, first_name from employees where dapartment_id = :DeptId
Define Bind variables DeptId in EmployeeListVO
Create View Object EmpDeptVO for defining the form elements.
This query varies according to your requirement. At least include employee_id and department_id in your select clause.
Define an Application Module and add above view objects to this application module.
Create a jspx page, drag EmpDeptVO to the jspx page and drop EmpDeptVO as ADF form.
Delete form elements for employee_id and department_id from the page.
Drag DepartmentId from data control under EmpDeptVO and drop as select one choice.
Click on add to define binding for List. Select DepartmentListVO from the Add data source drop down.
Select Display Attribute as DepartmentName.
Id of this select one chioce is auto populated as selectOneChoice1
Drag EmployeeId from data control under EmpDeptVO and drop as select one choice.
Click on add to define binding for List. Select EmployeeListVO from the Add data source drop down.
Select Display Attribute as FirstName.
Id of this select one chioce is auto populated as selectOneChoice2
Select selectOneChoice1 in structure window and go to properties.
Set AutoSubmit property to true
Select selectOneChoice2 in structure window and go to properties.
Set PartialTruggers property to selectOneChoice1
<af:selectOneChoice value="#{bindings.Departmentid.inputValue}"
label="Department"
id="selectOneChoice1" autoSubmit="true"">
<f:selectItems value="#{bindings.Departmentid.items}"
id="selectItems1"/>
</af:selectOneChoice>
<af:selectOneChoice value="#{bindings.Employeeid.inputValue}"
label="Employee"
id="selectOneChoice2"
partialTriggers="selectOneChoice1">
<f:selectItems value="#{bindings.Employeeid.items}"
id="selectItems2"/>
</af:selectOneChoice>
Right click on the page and go to page definition.
Right click on Bindings -Select 'Insert Inside Bindings' - Select 'Generic Bindings' - select 'Action'
Select EmployeeListVO from data collection
Select Iterator as EmployeeListVOIterator
Select Operation as ExecuteWithParams
Set the value of parameter 'DeptId' as #{bindings.Departmentid.inputValue}
Click OK
Right click on executables - Select 'Insert Inside executables' - select 'InvokeAction'
Give one meaningful id 'InvokeExecuteWithParams'.
Set 'Binds' as 'ExecuteWithParams'
Set 'Refresh' as 'RenderModel'
Click Finish
Drag InvokeExecuteWithParams above EmployeeListVOIterator
Run the page.
<bindings>
<action IterBinding="EmployeeListVOIterator" id="ExecuteWithParams"
InstanceName="HRAppModuleDataControl.EmployeeListVO"
DataControl="HRAppModuleDataControl" RequiresUpdateModel="true"
Action="executeWithParams">
<NamedData NDName="DeptId"
NDValue="#{bindings.Departmentid.inputValue}"
NDType="oracle.jbo.domain.Number"/>
</action>
..........
..........
</bindings>
<executables>
<invokeAction id="InvokeExecuteWithParams" Binds="ExecuteWithParams"
Refresh="renderModel"/>
<iterator Binds="EmployeeListVOIterator" RangeSize="-1"
DataControl="HRAppModuleDataControl" id="EmployeeListVOIterator"/>
...........
...........
</executables>
Read more...
How to implement drop down list in ADF
Friday, May 09, 2008
In this how-to example I am defining a department drop down list, which shows a list of departments.
Add the following code in the ADF page.
<af:selectOneChoice label="Department"
value="#{ModelData.department}">
<f:selectItems value="#{DepartmentOptions.departments}"/>
</af:selectOneChoice>
In ADF, selectOneChoice is used for drop down list.
selectOneChoice picks the list of values from 'selectItems' tag.
You can define a managed bean to bind an ArrayList of SelectItem objects to 'selectItems'. or can define a view object and bindings. In this example I have defined a managed bean which provides an ArrayList of SelectItem objects.
Department list Backing bean code.
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
public class DepartmentOptions {
private List departments;
public DepartmentOptions() {
departments = new ArrayList();
SelectItem department = new SelectItem("10", "Electric");
departments.add(department);
department = new SelectItem("20", "Mechanic");
departments.add(department);
department = new SelectItem("30", "Computer");
departments.add(department);
}
public void setDepartments(List departments) {
this.departments = departments;
}
public List getDepartments() {
return departments;
}
}
Read more...
Oracle ADF Faces Documentation
Tuesday, May 06, 2008
Oracle ADF Faces Documentation can be found here.
Read more...Understanding the disadvantages of using AJAX
Friday, April 25, 2008
Though Ajax delivers more responsive user interface and uses less band width over internet, understanding the disadvantages of using AJAX will help us to design better web applications.
The dynamically created page does not register itself with the browser history engine, so triggering the "Back" function of the users' browser might not bring the desired result.
Possible Solution
Using invisible IFRAMEs to invoke changes that populate the history used by a browser's back button.
Example: Google Maps - performs searches in an invisible IFRAME and then pulls results back into an element on the visible web page.
Dynamic web page updates make it difficult for a user to bookmark a particular state of the application.
Possible Solution
Use the URL fragment identifier to keep track of, and allow users to return to, the application in a given state. This is possible because many browsers allow JavaScript to update the fragment identifier of the URL dynamically, so that Ajax applications can maintain it as the user changes the application's state.
This solution also improves back-button support. It is not, however, a complete solution.
Response-time concerns
Network latency — or the interval between user request and server response — needs to be considered carefully during Ajax development. Without clear feedback to the user, preloading of data and proper handling of the XMLHttpRequest object, users might experience delays in the interface of the web application, something which they might not expect or understand. Additionally, when an entire page is rendered there is a brief moment of re-adjustment for the eye when the content changes. The lack of this re-adjustment with smaller portions of the screen changing makes the latency more apparent.
Possible Solution
Use of visual feedback (such as throbbers) to alert the user of background activity and/or preloading of content and data are often suggested solutions to these latency issues.
Search engine optimization
Websites that use Ajax to load data which should be indexed by search engines must be careful to provide equivalent Sitemaps data at a public, linked URL that the search engine can read, as search engines do not generally execute the JavaScript code required for Ajax functionality.
Reliance on JavaScript and the DOM
Ajax relies on JavaScript and the browser's Document Object Model (DOM), which are often implemented differently by different browsers or versions of a particular browser. Because of this, sites that use JavaScript may need to be tested in multiple browsers to check for compatibility issues. It's common to see JavaScript code written twice, one part for IE, another part for Mozilla compatibles, although this is less true with the release of IE7 and with the now-common use of JavaScript abstraction libraries like the Prototype JavaScript Framework or Jquery. Such libraries abstract browser-specific differences from the web developer.
Web analytics
Many web analytics solutions are based on the paradigm of a new page being loaded whenever new or updated content is displayed to the user, or to track a series of steps in a process such as a check-out. Since Ajax alters this process, care must be taken to account for how to instrument a page or a portion of a page so that it can be accurately tracked.
Possible Solution
Analytics systems which allow for the tracking of events other than a simple page view, such as the click of a button or link, are the ones most likely to be able to accommodate a site which heavily utilizes Ajax.
Google Web Toolkit (GWT) with Jdeveloper.
Google Web Toolkit (GWT) helps Java developers create Ajax applications more productively. GWT proposes a different way to create Ajax applications. It uses Java as a single programming language for both the client and server sides. GWT provides a compiler that translates the Java code on the client side into JavaScript and DTHML. This solution greatly simplifies the technology stack from the programmer’s point of view.
Jdeveloper has provided extension (gwtDeveloper) for Google Web Toolkit (GWT). You can get it using JDeveloper's Check for Updates mechanism.
What can you do with gwtDeveloper?
- Visually design your panels, composites, menus and other widget types
- View, change your widget's properties using Property Inspector
- Add event handlers to your widgets
You can find more about GWT Jdeveloper extensions at following link.http://www.gdevelop.com/
Also you can integrate GWT to Jdeveloper manually by following http://www.oracle.com/technology/pub/articles/dubois-gwt.html
ADF online Demos
For ADF online demos refer
http://radio.weblogs.com/0118231/stories/2005/06/24/jdeveloperAdfScreencasts.html
Configuring JDeveloper with SQL Server
For configuring jdeveloper with MS SQL Server refer http://www.devx.com/dbzone/Article/33681/0/page/2
Read more...How to forward to a page dynamically in ADF?
Monday, April 21, 2008
Sometimes you want to perofrm some validations and based on the result, forward to other ADF pages.
You can follow one of these following approches.
Approach I
/* Forward to page "myPage.jspx" */
FacesContext fc = FacesContext.getCurrentInstance();
UIViewRoot viewRoot = fc.getApplication().getViewHandler().createView(fc, "/myPage.jspx");
fc.setViewRoot(viewRoot);
fc.renderResponse();
Approach II
/* Forward to the navigation rule "mypage" */
FacesContext fc = FacesContext.getCurrentInstance();
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "mypage");
Approach III
/* Redirect to page myPage.jspx */
FacesContext.getCurrentInstance().getExternalContext().redirect(/myPage.jspx);
Approach I and II preserve the processScope
Database native Web services - A Cool feature in Oracle 11g
Tuesday, April 15, 2008
Web services have become a popular way of developing applications. Until now, creating a Web service has required hand-coding or generating the programs necessary to expose a SOAP end-point, and then deploying this code using an application server. These programs need to address all aspects of a Web service’s usage, including generating the WSDL document, parsing and processing the SOAP request, and marshaling the required data into the correct XML format to provide the SOAP response.
Database native Web services, delivered as part of Oracle Database 11g, eliminates all of this complexity for Web services that provide access to data stored in an Oracle Database. Database native Web services let you expose PL/SQL stored procedures, functions, and packages as Web services with zero coding and zero deployment effort. The database native Web services feature also includes a Web service that supports execution of dynamic SQL queries and XQuery expressions. The database HTTP server, provided as part of Oracle XML DB Repository, allows these Web services to be accessed using HTTP and HTTPS, without any additional application server infrastructure. Database native Web services leverage the powerful XML capabilities of Oracle XML DB to automatically generate the WDSL, parse and process the SOAP request, and generate the SOAP response.
A nice step-by-step artcile for using Database native Web services can be found here.
Separating Rules from Business Processes.
Service-oriented architecture (SOA) facilitates the development of enterprise applications as modular business services that can be easily integrated and be reused. Business Process Execution Language (BPEL) enable services to be orchestrated into business processes, which can be changed easily in response to business requirements. SOA promises simplified integration and increases service reuse.
Change in Business Requirements does not always mean change in Business Process but often mean changes to the rules that drive the process.
A typical business process often includes a number of decision points. These decision points generally have an effect on the process flow; for example, someone's credit rating may determine whether he or she is approved for a low-cost loan. These decisions are evaluated based on certain conditions and facts, which may be internal or external to the business process, and predefined company policies or rules. Business rules engines (BREs) allow architects to easily define, manage, and update the decision logic that directs enterprise applications from a single location without needing to write code or change the business processes calling them.
Embeding the business rules inside the business process has savaral drawbacks.
- Business rules change more often than the processes themselves, but changing and managing embedded business rules is a complex task beyond the abilities of most business analysts. Thus, as business rules change, programmers often have commit expensive time to this task.
- Most organizations lack a central rules repository. Consequently, any organization-wide change in policy cannot be applied across all business processes.
- Business processes cannot reuse rules. Hence, IT personnel end up designing rules for each and every process, often leading to inconsistency or redundancy.
The best way to avoid these problems is to separate business processes from business rules. Rules can be exposed as services and BPEL processes can leverage these services by querying the rules engine when they reach decision points.
Following Steps can be followed to use Rules along with BPEL.
- Create rules in a ruleset.
- Expose the ruleset as a Web service.
- Invoke the ruleset Web service from BPEL.
Generating XML data from database table and views
Monday, April 14, 2008
Oracle provides functions and packages for generating XML data from database table and views.
Following options can be used to generate XML from Oracle content.
- Using SQLX Functions
- Using Oracle Extensions to SQLX
- Using DBMS_XMLGEN
- Using SQL Functions
- Using XSQL Pages Publishing Framework
- Using XML SQL Utility (XSU)
Creating skin for ADF Application
Friday, April 11, 2008
A skin is a global style sheet that affects the entire application. You can create one skin for the entire application . Every component will automatically use the styling as described by the skin. Any changes to the skin will be picked up at runtime, no change to code is needed. Skins are based on the Cascading Style Sheet (CSS) specification. You can also dynamically switch skins during runtime.
In JDeveloper 11 you don't need to write a complete skin just to change a single component. You can extend an existing skin.
To create a skin, you can refer this document.
ADF Business Components Validation Flow Chart
Read more...
Using BPEL in ADF
The common way of using web services in Oracle ADF is to create a data control for an external web service. JDeveloper allows you to create a data control for an existing web service using just the WSDL for the service.
Here you can watch a nice demo to use BPEL with ADF.
Order of method calls in Entity Object
Thursday, April 10, 2008
Though I found a lot of reference about Entity Object methods and thier usage, I never found a document describing order of method calls in Entity Object. Here I am trying to put the method call order in place.
Entity Create flow.
Loop for each created entity Object
{
validateEntity();
prepareForDML();
doDML();
}
Loop for each created entity Object
{
beforeCommit();
}
Enabling Partial Page Rendering(PPR) in ADF.
For a component to trigger another component to refresh, the trigger component must cause a submit when an appropriate action takes place.On the trigger command component set the id attribute to a unique value. If it is an input component in a form, set the autoSubmit attribute of thecomponent to true. Otherwise, set the partialSubmit attribute of the component to true.
For a component is to be refreshed triggered by another component, it must declare which other components are the triggers.On the target component that you want to partially refresh when the trigger command component is activated, set the partialTriggers attribute to the id of the trigger command component. If the component refresh is to be triggered by more than one other component, list their IDs separated by spaces.
Following three main component attributes are used to enable partial page rendering.
autoSubmit: When the autoSubmit attribute of an input or select component is set to true, and an appropriate action takes place (such as a value change), the component automatically submits the form it is enclosed in.
partialSubmit: When the partialSubmit attribute of a command component is set to true, clicking the button or link causes the page to be partially submitted.
partialTriggers: All rendered components support the partialTriggers attribute. Use this attribute to list the IDs of components whose change events are to trigger this component to be refreshed.
What is Trinidad?
Trinidad is Oracle's JSF component library which Oracle has donated to Apache MyFaces.
Trinidad is a JSF framework including a large, enterprise quality component library, supporting critical features such as accessibility (e.g. Section 508), right-to-left languages, etc. It also includes a set of framework features, including :
- Partial-page rendering support for the entire component set
- Integrated client-side validation
- A dialog framework
- pageFlowScope, for communicating between pages
Oracle's ADF Faces Rich Client components are based on these Trinidad components.
Read more...How to display the content of a BLOB column(e.g. Image) in a ADF/BC pages ?
Wednesday, April 09, 2008
If you have some image in the database table BLOB column and you want to display the image on the screen, you can follow the following approach.
1: Write a simple servlet that streams the blob back to the client as an image.
2: Add an image to the page from the component pallete.
3: Change the source attribute of image to /yourServletname?thumbnail=#{bindings.yourbindingvalue}
e.g./imageservlet?thumbnail=#{bindings.ProductId}
I have taken the servlet code from the FOD (Fusion Order Demo). Modify the following code according to your application specific object usage.
package oracle.fodemo.storefront.servlet;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
public class ImageServlet extends HttpServlet {
private static final String CONTENT_TYPE =
"image/jpg; charset=utf-8";
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
response.setContentType(CONTENT_TYPE);
response.setContentType(CONTENT_TYPE);
String detailProductId = request.getParameter("detail");
String thumbnailProductId = request.getParameter("thumbnail");
boolean thumbnail = true;
String productId = null;
OutputStream os = response.getOutputStream();
Connection conn = null;
try {
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/FODDS");
conn = ds.getConnection();
PreparedStatement statement = conn.prepareStatement(
"SELECT ProductImageEO.PRODUCT_IMAGE_ID, " +
" ProductImageEO.PRODUCT_ID, " +
" ProductImageEO.DEFAULT_VIEW_FLAG, " +
" ProductImageEO.DETAIL_IMAGE_ID, " +
" ProductImageEO.IMAGE " +
"FROM PRODUCT_IMAGES ProductImageEO " +
"WHERE ProductImageEO.DEFAULT_VIEW_FLAG = ?" +
" AND ProductImageEO.PRODUCT_ID = ?");
if (detailProductId != null) {
productId = detailProductId;
thumbnail = false;
} else {
productId = thumbnailProductId;
}
statement.setString(1,(thumbnail ? "Y" : "N"));
statement.setInt(2, new Integer(productId));
ResultSet rs = statement.executeQuery();
if (rs.next()) {
Blob blob = rs.getBlob("IMAGE");
BufferedInputStream in = new BufferedInputStream(blob.getBinaryStream());
int b; byte[] buffer = new byte[10240];
while ((b = in.read(buffer, 0, 10240)) != -1) { os.write(buffer, 0, b); }
os.close();
}
} catch (Exception e){
e.printStackTrace();
} finally {
try{
if (conn != null){
conn.close();
}
} catch (SQLException sqle){
sqle.printStackTrace();
}
}
}
ADF EO - Assigning Database Sequence value to an Attribute at time of row creation.
Sometimes you need to assign a database sequence value to an attribute at entity row creation time. Override the create() method and use SequenceImpl helper class in the oracle.jbo.server package to get the sequence value.
Example:
import oracle.jbo.server.SequenceImpl;
protected void create(AttributeList nameValuePair) {
super.create(nameValuePair);
SequenceImpl sequence =
new SequenceImpl("EMPLOYEE_SEQ",getDBTransaction());
setEmpId(sequence.getSequenceNumber());
}
ADF - validate the username and password against a database table
Container-managed security allows web applications to delegate authentication and authorization decisions to the executing web container.In Oracle Containers for J2EE (OC4J) the authentication and authorization decision is handled by the OracleAS JAAS Provider.Web applications running in OC4J can be configured to authenticate users against Oracle Internet Directory (OID), third-party LDAP, CoreId, jazn-data.xml or a custom JAAS LoginModule.The benefit of container-managed security in contrast to a pure JAAS approach (Java Authentication and Authorization Service) approach is that the application logic is not mixed with authentication and authorization code, which ensures portability.
This article explains how to leverage database tables for storing account information for user authentication and authorization of Java EE applications in JDeveloper 10.1.3.2 and OC4J 10.1.3.2.
Find the article here.
Most Commonly Used Methods in ADF Business Components
Tuesday, April 08, 2008
Steve Muench has compiled a list of Most Commonly Used Methods in ADF Business Components. It includes the methods that ADF developers write, call, and override most frequently.
The list can be found here.
Life Cycle of an Entity Object.
When a new row is created on entity-based view object, the entity status is set as New. Transaction's list of pending changes is updated with the new row. When the transaction is committed, the row will be saved to the data base. But when a blank row is created, the user may not have entered any data. So by setting the row status to 'initialized', the new row can be forced to remove from the Transaction's list of pending changes. This prevents the system from posting the row into database, if the user never enters any data into any attribute of that initialized row. When the user enters data into any attribute of the initialized row, the row status changed to New.
When an entity is retrieved from the database, its status is set as Unmodified. When the user enters data into any attribute of the unmodified row, the row status changed to Modified. When user calls remove() on Unmodified row, the row status changes to Deleted. If the row is in New state and the user calls remove() on the row, row status changes to Dead.
When an entity is retrieved from database, the entity is assumed to be valid. When any attribute of the entity is modified or a new entity row is created, the entity is marked as invalid. Before committing the transaction, system validates all invalid entity rows in the Transaction's pending list. Then the changes are posted to database and the row status changes to Unmodified.
Difference between setCurrentRowWithKey and setCurrentRowWithKeyValue?
setCurrentRowWithKey takes serialized value of rowKey as parameter e.g. 000200000002C20200000002C102000000010000010A5AB7DAD9
The serialized string representation of a key encodes all of the key attributes that can be conveniently passed as a single
value in a browser URL string or form parameter.
The serialized string key of a row can be accessed by referencing the rowKeyStr property of an ADF control binding (e.g. #{bindings.SomeAttrName.rowKeyStr})
setCurrentRowWithKeyValue takes literal value as parameter e.g "201"
How to change the Oracle ADF look and feel?
Friday, April 04, 2008
Oracle supports skinning i.e. changing the look and feel of the application.
You can develop your own skin e.g. CustomSkin.css
Step 1: Put CustomSkin.css and all dependent resources at the root
of your application e.g. /skins/myskin/CustomSkin.css
Step 2: Register the custom skin
In JDeveloper, right click on the WEB-INF folder of the sample project
and create a new XML document and name it - adf-faces-skins.xml
Replace the generated code with the following:
<skins xmlns="http://xmlns.oracle.com/adf/view/faces/skin">
<skin>
<id>mycompany.desktop</id>
<family>myskin</family>
<render-kit-id>oracle.adf.desktop</render-kit-id>
<style-sheet-name>/skins/myskin/CustomSkin.css</style-sheet-name>
</skin>
</skins>
Save your work.
Step 3: Modify adf-faces-config.xml file to use the custom skin.
Open the adf-faces-config.xml file.
Replace the <skin-family>value with custom skin family name
e.g. <skin-family>myskin</skin-family>
Save your work.
Step 4: Run your application and test.
Useful ADF Blogs
These Blogs made my life easier. Hope these will help you too.
Frank Nimphius Blogbuster
Dive into Oracle ADF
Shay Shmeltzer's Weblog
The Peninsula's Edge
The GroundBlog By Duncan Mills
Matthias Wessendorf's Weblog
Grants Blog
Tug's Blog
Chris Muir
Real World ADF
Gerard Davison's Blog
Andrejus Baranovskis's Blog - JDev/ADF Samples list
Java / Oracle SOA blog
How to add one master and many details in Oracle ADF?
Oracle ADF helps you to define master detail regions by drag and drop. But 'drag and drop' is only possible for one master and one detail combination. For one master and many details design follow the following steps.
let us assume, you need one master and two detail.
Region Structure
---------------------------
Master1
|
|________ Detail1
|
|________ Detail2
View Objects
----------------------------
MasterVO
|
| VL1
|___________DetailVO1
|
| VL2
|___________DetailVO2
Step 1: Drag DetailVO1 from Data Control Palette.
Drop on the page design and select 'Master Detail => ADF master table, Detail Table'
This will create Master1 table and Detail1 table
Step 2: Drag DetailVO2 from Data Control Palette.
Drop on the page design and select 'Master Detail => ADF master table, Detail Table'
This will create Master2 table and Detail2 table
Step 3: Delete Master2 table
Step 4: Select Detail2 table. In the property inspector, Behavior tab, put Master1 in the Partial Triggers field. (Note: Master1 is the master table name).
Run the page and test.