Frank Nimphius
Partition form updates with partial form submit using af:subform with ADF
A common application development use case is partial form submit, in which configurable parts of an input form are submitted while others are not. The form submit may be performed on a single page or across views, for example in the course of an entry wizard. ADF Faces provides the af:sub form component to partition input forms for partial submit. By default, the ADF binding layer does not know how to handle partial form submits and instead produce validation errors, unless developers tell it how to. This blog entry is an addition to the af:subform discussion in the Oracle Fusion Developer Guide book by Mc Graw Hill.
Frank
Gotchas when using memory scope prefixes in EL to access managed beans
Interesting post on the Oracle JDeveloper Oracle internal mailing list, answered by Andrew Robinson. Accessing a managed bean in a standard servlet scope like sessionScope or requestScope using the scope as a prefix fails if the bean instance does not exist. Thus, bean reference like #{sessionScope.myBean} may fail while #{myBean} always succeeds. The reason for this is that #{sessionScope….} and #{requestScope…} reference a Map in memory and not the JSF framework.
But why would you want to use the memory scope as a prefix? If you reference an attribute in memory scope, then the search goes from smallest scope to broader scope, which means that if – by accident – there exist two objects with the same name and you wanted to access the object in the broader scope, chances are you access the wrong object. So prefixing the expression puts you on the save side. This however is only good to use when you access objects that already exist in memory (wich could be a previously instantiated managed bean – of course)
Managed beans must be instantiated before they become available in the memory scope, which means they need to be accessed through JSF. Luckily, JSF does not allow to configure two managed beans with the same name in different scopes. So even without a scope prefix, there is no risk that application code accidentally accesses the wrong object.
Note however that using ADFc specific scope like viewScope and pageFlowScope, a prefix of “pageFlowScope” or “viewScope” is required in the EL reference.
Frank
How-to protect your ADF pages
A great discussion on the JDeveloper forum on OTN brough a new addition to ADF application security that I like to share.
Chapter 30 of the Oracle® Fusion Middleware Fusion Developer’s Guide for Oracle Application Development Framework 11g Release 1 explains the JAAS protection mechanism for ADF pages and Task Flows. In here it is recommended that you reduce the number of JSF pages in the adfc-config.xml file to the absolute minimum and only give ADF Security permissions to those documents that need to be accessible from a browser request.
All other pages should be located in bounded task flows, which you can protect declaratively against GET requests, as they are issued from a browser URL. Bounded task flows need to be ganted to users through application roles to be accessible.
The discussion on OTN is about protecting the phyical JSPX files. If you are an authenticated and authorized user, then you could directly access the JSPX page, e.g. calling localhost:7101/myapp/faces/Departments.jspx. This then serves the page – though it may not be fully functional because it is not launched within the controller context.
The recommendation therefore is to store JSPX documents under the WEB-INF directory of the public_html folder. This solves the problem of users accessing physical files directly
Frank
Ps.: Note that if moving JSPX documents into the WEB-INF folder is not an option for you, you can write a servlet filter that checks the incoming request URL for the resource it accesses. If a jspx file is accessed you would return a http 403 error.
The Poetry of Wisdom in Oracle Documentation: E.g. PPR and List Of Values
Our ADF Faces documentation contains little nuggets of poetry and wisdom that are easy to memorize helping you to better understand the product – and answer questions on OTN with it. For example, today I found and liked:
Note: If your trigger component is an inputLov or an inputComboBoxLov, and the target component is an input component set to required, then a validation error will be thrown for the input component when the LOV popup is displayed. To avoid this, you must use programmatic partial page rendering.
Note: In some cases, you may want a component to be rerendered only when a particular event is fired, not for every event associated with the trigger component, or you may want some logic to determine whether a component is to be rerendered. In these cases, you can programatically enable PPR.
Excellent !
Frank
Want to dig your own nuggets? here is the documentation: Looking forward to read your blogs and tweets with your favorite quotes.
ADF Code Corner : How-to Edit Bounded Task Flows in a new Browser Tab (Tab Browsing)
Just finished a new blog article about launching a bounded task flow in a new browser tab. This article addresses the popular tab browsing feature in browsers, showing how – assuming the business use case requires it – you do the same in ADF Faces. The specialty is that the tab browsing is not initialted from a link but a tree component. Rading this blog post, you learn
- Making a bounded task flow URL accessible
- Launching a new browser window from a managed bean
- Defining the bounded task flow request URL in Java
- Passing input parameters to a task flow using a HashMap
- Use the hierarchical tree context menu to invoke an action on right mouse click
- Adding JavaScript to a managed bean response
Frank
ADF Code Corner: How to deploy ADF bounded task flows in ADF Libraries
I just upoaded a new how-to to ADF Code Corner. This how-to explains how to package and deploy ADF task flows – with or without dependent model projects – in ADF Libraries. In addition it explains how to import an ADF library, configure contained database connections and rename the task flow content names to be user friendly.
ADF Code Corner on Twitter !
Just in case …
- you are worried about missing bits of information about Oracle JDeveloper and ADF
- you feel uncomfortable saying “If I had known this before it would have saved me …”
- you don’t have time to frequently browse OTN
- you enjoy technical stuff more than knowing what Paris Hilton did last week
- you want to know more than others do
ADF Code Corner “twitters” interesting updates and information about Oracle JDeveloper, ADF and related topics.
Get More, Learn More: http://twitter.com/fnimphiu
Frank
How-to Create custom ADFc Exception Handler
The ADFc controller provides declarative exception handling. However, if you need to customize this exception handler, for example to redirect a request to a custom session expiry page, then you can do this as follows
- Create a Java class that extends AdfcExceptionHandler
- Create a textfile with the name “oracle.adf.view.rich.context.Exceptionhandler” (without the quotes) and store it in .adf\META-DATA\services (you need to create the “services” folder)
- In the file, add the absolute name of your custom exception handler class (package name and class name without the “.class” extension)
For the expiry example, in the handleException method, you check throwable.getMessage() for “ADF_FACES-30108″ which indicates the expiry message. Don’t forget to pass exceptions your custom class doesn’t handle to the super class not to break any default functionality.
However, You should always try and use declarative exception handling when possible. For example, a router activity that is marked as the exception handler can access a managed bean method, which then accesses the ControllerContext.getCurrentInstance(), and in here the ViewPort, for determining the Exception type and message. So keep the hint of how to extend the the ADFc controller class as an exception to the rule of using declarative excpetion handler and use it only if you can’t find out how to handle an exception it otherwise.
Configuring the ADFc custom exception handling class is not yet part of the product doumentation but will be added the next JDev 11g Patch Set as part of the task flow content.
The above hint is a brief summary excerpt taken from the Oracle Fusion Developer Guide book that Lynn Munsinger and I wrote for McGraw Hill. I am blogging this in response to a question on the JDeveloper OTN forum.
Frank
Oracle ADF Code Corner: How-to scroll an ADF bound ADF Faces Table using a Keyboard Shortcut
The Oracle JDeveloper code editor allows developers to navigate to a specific line in the source code using the ctrl+g keyboard shortcut. In this how-to article, I use the same approach, which is to allow users to press ctrl+g on a table at runtime to provide the row number they want to navigate to. The sample is an improved version of the sample Lynn Munsinger and I provide in our book “Oracle Fusion Developer Guide Building Rich Internet Applications with Oracle ADF Business Components and ADF Faces” and nicely shows how JavaScript can be used to provide client side functionality in ADF Faces RC, plus how the ADF binding layer is used to scroll a table.
Frank
How-to scroll ADF tables using alphabetic anchor tags in an index menu
In this example, an alphabet index anchor menu is used to scroll an ordered ADF bound ADF Faces table. The example provided for download is based on the HR Employees table. Selecting an entry from the index menu, for example the ‘F’ character, scrolls the table to the first employee record that has this character as the first character of the last name attribute value. The implementation dynamically builds the index list, ensuring that characters that are not available as leading characters in the last name attribute are rendered but disabled for selection.

[Read More] [Get More on ADF Code Corner]
Frank
Our book is out: Oracle Fusion Developer Guide: Building Rich Internet Applications with Oracle ADF Business Components and Oracle ADF Faces
Just learned today that Lynn Munsinger and my book ships in the US since December 11. I checked the Amazon website and indeed you could get it in time for Christmas (just in case you are looking for a last minute gift for your wife or husband). See yourself.
The closer we got to Christmas, the more exiting it was for me to see if McGraw Hill would make it publishing the book before Cristmas. Not that this makes a difference, but Lyn and I worked hard on meeting our schedules and though the book was announced for January 2010 I like it to be ahead of schedule. So I can call this a year and enjoy Christmas and new year eve with my family – no thinking of Java (possibly)
Thanks to McGraw Hill.
Merry Christmas to everyone.
Frank
Forum: ADF UI Patterns & Best Practices
ADF users I meet often express an interest in ADF design patterns and best practices that we could/should carve out of what Oracle Applications exercises and experiences since the origin of Fusion application development in Oracle JDeveloper 11g. Not many know that there is a forum and website dedicated to those patterns. So to increase traffic on this sites, here are the links
http://forums.oracle.com/forums/forum.jspa?forumID=764&start=0
http://www.oracle.com/technology/products/adf/patterns/index.html
For generic questions and problems with ADF and its associated technologies, please continue posting to
http://forums.oracle.com/forums/forum.jspa?forumID=83
Frank
Heads-up: Required Security update for ADF Sample in Fusion Developer Documentation
A code sample in section 30.7.2.1, “Creating Login Code for the Backing Bean” of the Fusion Developer’s Guide for Oracle ADF (part number B31974-04) needs to be updated to create a new sessionId for the session right after authentication, thus protecting applications against session fixation attacks. A simple code fix is to change the sample’s doLogin() method with an extra line after line 10 :
ServletAuthentication.runAs(mySubject, request);
ServletAuthentication.generateNewSessionID(request);
Note that the dcumentation is updated too and a new version is available on OTN. This blog entry is to ensure we reach all users that don’t read release note documentation on a regular basis.
See the updated documentation code here:
http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/adding_security.htm#BGBFJJJH
Frank
How-to Configure the ADF Faces Carousel Component with ADF
The af:carousel component is new in Oracle JDeveloper 11g R1 PatchSet 1. Though the carousel component is one of the choices in the context menu when dragging a View Object collection from the Data Controls palette onto a page, its not fully configured when selected. Instead, to setup the carousel to show ADF bound data, you need to explicitly add the databound content to the component’s nodestamp facet. To implement a master-detail behavior where the carousel component represents the master row set, you need to implement the CarouselSpinListener using Java in a managed bean to mark the selected carousel item as the current selection in the binding layer. In this how-to article we provide the detailed steps of how to build a master-detail implementation of an ADF bound carousel and also give you a generic implementation of the CarouselSpinListener a hand that works with any ADF bound carousel. You can copy and paste into your custom development or make it part of a library.
Frank


