Generic Selection Listener implementation for ADF bound ADF Faces Tables
By frank.nimphius | March 17, 2010
Creating an ADF bound table with drag and drop from the ADF Data Control Palette configures the selectionListener property of the ADF Faces table component with EL. The expression references the makeCurrent function that exists on the ADF Faces binding class at runtime. Unless you want to add pre-processing or post-processing instructions to the execution of the selection listener, there is no need to change this setting. However, if you have a need to change it, then you can’t just use the makeCurrent in your Java code because FacesCtrlHierBinding, the ADF Faces binding object for tables and trees, is located in an internal package and is for internal framework use only. In this article I explain how your build your own generic Java implementation of an ADF table selection listener to perform what the makeCurrent method does, just with a public API.
Frank
Topics: ADF, ADF Faces, ADF Faces RC, JDeveloper | No Comments »
Partition form updates with partial form submit using af:subform with ADF
By frank.nimphius | March 14, 2010
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
Topics: ADF, ADF Faces RC | No Comments »
Gotchas when using memory scope prefixes in EL to access managed beans
By frank.nimphius | March 9, 2010
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
Topics: ADF Faces RC, Taskflow | No Comments »
How-to protect your ADF pages
By frank.nimphius | March 8, 2010
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.
Topics: ADF, ADF Faces RC, Security | No Comments »
The Poetry of Wisdom in Oracle Documentation: E.g. PPR and List Of Values
By frank.nimphius | March 5, 2010
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.
Topics: Uncategorized | No Comments »
ADF Code Corner : How-to Edit Bounded Task Flows in a new Browser Tab (Tab Browsing)
By frank.nimphius | February 25, 2010
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
Topics: ADF Faces RC, JDeveloper, JavaServer Faces, Taskflow | No Comments »
ADF Code Corner: How to deploy ADF bounded task flows in ADF Libraries
By frank.nimphius | February 17, 2010
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.
[Read More] [Get More] [Follow ADF Code Corner on Twitter]
Topics: Uncategorized | No Comments »
ADF Code Corner on Twitter !
By frank.nimphius | February 8, 2010
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
Topics: ADF, ADF Faces RC, ADF Security, JDeveloper | No Comments »
How-to Create custom ADFc Exception Handler
By frank.nimphius | February 1, 2010
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 ExceptionHandler
- 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 rethrow execptions that your custom class doesn’t handle so it can be handled by the ADFc default Exception handler.
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
Topics: ADF Faces RC | No Comments »
Oracle ADF Code Corner: How-to scroll an ADF bound ADF Faces Table using a Keyboard Shortcut
By frank.nimphius | January 8, 2010
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
Topics: Uncategorized | No Comments »
« Previous Entries
