Main

Faces Archives

September 17, 2009

Encoding of ADF Faces Pages


I got several issues this week that had the same root cause though the symptoms were completely different.

The problem is related to the page encoding of the ADF Faces JSPX.
ADF Faces supports 'utf-8' only.
However, by default, the editor creates the pages with the 'windows-1252' encoding:
Windows1252.png

This leads to problems like:

  • accented characters transformed to code representation during the Submit - see the discussion "Character encoding problem in ADF 11 app" in the OTN Forum
  • Error: "The value is not a number" when using groupingUsed="true" with specific locale (French f.ex.)
  • ...

To avoid these issues, you can edit your pages and change 'windows-1252' by 'utf-8'.
For the new pages, you can change the default to 'utf-8':

  1. select menu "Tools" -> "Preferences..."
  2. click "Environment"
  3. select "UTF-8" in the "Encoding" list.


Encoding.png


The new pages will be created correctly now.
Note that as from JDeveloper 11.1.1.2.0 onwards, JDeveloper will use the encoding 'utf-8' (whatever the default encoding is) when ADF Faces technology is used.

May 27, 2009

Warning "Transient state added to StateManager. State may not be serialized."

We get a lot of questions about the following warnings displayed when running ADF Faces pages including a DVT graph component:

25-May-2009 3:22:02 PM oracle.adf.share.http.HttpSessionStateManagerImpl putState
WARNING: Transient state added to StateManager. State may not be serialized.
State id: data.view_graph1_pagePageDef.graph1__cubicDefinition
25-May-2009 3:22:03 PM oracle.adf.share.http.HttpSessionStateManagerImpl putState
WARNING: Transient state added to StateManager. State may not be serialized.
State id: data.view_graph1_pagePageDef.graph1__dataModel

We discussed the issue with our development team and here was their feedback:

The Graph puts persistent state objects on the StateManager, these objects are Serializable. In addition the Graph also puts transient state objects on the StateManager, these objects are not Serializable.
Note that Graph does not depend on these transient objects always being available on the StateManager, it only uses them for performance if they are there. These transient objects can be recreated from the persistent objects which will always be available.

In other words, you can ignore this warning.

December 23, 2008

Dialog Not Opening In A Popup Window In JDev 11g

We get a lot of questions at Oracle Support about the dialogs not opening in a separate, dialog window in JDeveloper 11g.

For example, suppose you specified the following:

faces-config.xml

<?xml version="1.0" encoding="windows-1252"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
  <application>
    <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
  </application>
  <navigation-rule>
    <navigation-case>
      <from-outcome>dialog:popup</from-outcome>
      <to-view-id>/popup.jspx</to-view-id>
    </navigation-case>
  </navigation-rule>
</faces-config>


yourMainPage.jspx
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <jsp:directive.page contentType="text/html;charset=windows-1252"/>
  <f:view>
    <af:document>
      <af:form>
        <af:commandButton useWindow="true" action="dialog:popup" text="Open Popup"/>
      </af:form>
    </af:document>
  </f:view>
</jsp:root>

Note the following properties:
useWindow="true" action="dialog:popup"
that should open the page as a popup dialog.


This worked correctly in JDeveloper 10g
In JDeveloper 11g however, it opens popup.jspx in the same browser window as yourMainPage.jspx, and not in a dialog window.

The reason is that you used faces-config.xml to configure your navigation rule, instead of adfc-config.xml.
From the "Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework",
Chapter 17 Creating Complex Task Flows,
topic "17.7 Running an ADF Bounded Task Flow as a Modal Dialog"

If your application uses ADF Controller features (for example, ADF task flows), specifying dialog: syntax in navigation rules within faces-config.xml is not supported.
However, you can use the dialog: syntax in the control flow rules that you specify in the adfc-config.xml file.

So you should specify the flow in adfc-config.xml:

adfc-config.xml

<?xml version="1.0" encoding="windows-1252" ?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
  <view id="main">
    <page>/main.jspx</page>
  </view>
  <view id="popup">
    <page>/popup.jspx</page>
  </view>
  <control-flow-rule>
    <from-activity-id>*</from-activity-id>
    <control-flow-case>
      <from-outcome>dialog:popup</from-outcome>
      <to-activity-id>popup</to-activity-id>
    </control-flow-case>
  </control-flow-rule>
</adfc-config>

See also "A.3 Configuration in faces-config.xml"
Typically, you would configure the following in then faces-config.xml file:

  • Application resources such as message bundles and supported locales

  • Page-to-page navigation rules

  • Custom validators and converters

  • Managed beans for holding and processing data, handling UI events, and performing business logic

Note:
If your application uses the ADF Controller, these items are configured in the adfc-config.xml file. For more information, see the "Getting Started With Task Flows" chapter of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

June 9, 2008

Buttons Generated As Standard Html Buttons In ADF Faces On Linux


Problem

This question comes regularly in the OTN forums.

You have developed your application on a Windows system and defined your own skin (css), including some customizations for the buttons f.ex.:
.AFButtonServerText:alias
{
    color:black;
    background-color: #D2DEED;
    font-weight:bold;
    font-family: Arial, Helvetica;
    font-size: 11px;
}

.AFButtonServerTextDisabled:alias
{
    color:#AAAAAA;
    font-family:Arial, Helvetica;
    font-size: 11px;
    font-weight: normal;
}

When you run the application in the Embedded OC4J on Windows, the page renders correctly, with the buttons generated as "image buttons":
ADFButton:

However, the same application deployed on iAS on your Linux machine shows the buttons as standard HTML buttons:
StandardButton: .

You use the following Java Option in iAS on Linux:
   -Djava.awt.headless=true
as recommended in the JDeveloper online help, "About ADF Faces Supported Platforms".

So, what's the problem ?

Cause

The font "Arial" is not available on your Operating System.

The ADF Faces buttons are normally generated as GIF files by the Java's AWT graphics library.
When the Java API doesn't have access to the specified font, it generates the button as a standard HTML button.

Solution

Either install the missing font on your Linux system (the Java API will use it to generate the image buttons) or use another font.

The best choice to avoid the problem when deploying the application on different platform is to specify a logical font (Dialog, SansSerif, ...), that's mapped to an existing physical font on your OS.
You can find the list of the mapping in <iAS_Home>\jdk\jre\lib\font.properties
NB: this name may differ depending on the OS

F.ex. the "SansSerif" logical font is mapped to the "Lucida Sans" physical font:
sansserif.plain.latin-1=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
and the Lucida font is always installed as part of the JDK (in ...\jre\lib\fonts).
So you are sure with this solution that the buttons will always be generated as image buttons, whatever the OS you are deploying to.


NB: though it was written for UIX, most of the information contained in the chapter "18. Image Generation in ADF UIX" of the "Oracle ADF UIX Developer's Guide" is still valid for ADF Faces.

June 4, 2008

Internet Explorer 7 Support

As you can read in the "Oracle JDeveloper 10.1.3.3.0 Installation Guide", the browsers that are supported in the current release of JDeveloper are:

  • IE 5.5
  • IE 6.0 (XP only)
  • Netscape 7.2
  • Mozilla 1.7
  • Firefox 1.0.4
  • Firefox 1.5
  • Firefox 2.0
  • Safari 2.0
We are regularly contacted at Oracle Support about the support of Internet Explorer 7.
IE 7 is not supported with JDeveloper 10.1.3.3.0

Development was not sure to be able to certify IE 7 before the release of JDeveloper 10.1.3.5
However, I have got the good news from the development team that they could finally complete the certification for IE7 in JDeveloper 10.1.3.4

April 30, 2008

Only Rendered ADF Faces Components Can React To PPR


This question comes regularly at Oracle Support and in the forums.
You want to show (render) and hide an ADF Faces component dynamically on your page, depending on the value of another component.

Suppose f.ex. a Radio Group with 2 buttons "Show" and "Hide'.
Clicking "Show" should display a button; it should disappear when clicking "Hide".
For that, you defined a selectOneRadio that saves the values "show" and "hide" in your backing bean, in an attribute "radioBtnValue":

            <af:selectOneRadio label="Show/Hide" id="yourSelectOneRadio"
                               value="#{Backing.radioBtnValue}"
                               autoSubmit="true">
              <af:selectItem label="Show" value="show"/>
              <af:selectItem label="Hide" value="hide"/>
            </af:selectOneRadio>
You then defined your button as the following:
            <af:commandButton text="Button"
                              rendered="#{Backing.radioBtnValue=='show'}"
                              partialTriggers="yourSelectOneRadio"/>
Because of the partialTriggers property, you are expecting the button to be updated when an event occurs on the selectOneRadio.
The rendered property should then be re-evaluated and set to true when the button "Show" was clicked.

Unfortunately, it doesn't work

You cannot use PPR (Partial Page Rendering)
to directly toggle the "rendered" attribute of a component.
You have to wrap
the component (with the rendered attribute) in a parent component and set the
partialTriggers in its parent.
The reason is that only components that
are rendered can react to PPR.

In the example above, you can create a parent with the partialTriggers property, a panelGroup f.ex.:


            <af:panelGroup partialTriggers="yourSelectOneRadio">
                 <af:commandButton text="Button"
                                   rendered="#{Backing.radioBtnValue=='show'}"/>
               </af:panelGroup>

When an event occurs on the selectOneRadio, the parent component will react to PPR.
During the PPR,
the parent component and all its children will be updated.

the rendered property of the button will be evaluated and the button
displayed or hidden accordingly


I added sample 7 to my ADF Sample Applications page.


April 21, 2008

invokeAction Invoked Twice

Symptom

Suppose you published an Application Module method as a client method, f.ex.:
public void yourMethod() {
   System.out.println("Hello World");
}

You created an ADF Faces page and included the following in your page definition (<yourPage>PageDef.xml):
...
  <executables>
    ...
    <invokeAction Binds="yourMethod" id="executeYourMethodAction"
                  RefreshCondition="${!adfFacesContext.postback}"/>
    ...
  </executables>
  <bindings>
...
  <methodAction id="yourMethod" InstanceName="AppModuleDataControl.dataProvider"
                DataControl="AppModuleDataControl" MethodName="yourMethod"
                RequiresUpdateModel="true" Action="999"
                IsViewObjectMethod="false"/>
  </bindings>
</pageDefinition>

The aim is to execute yourMethod when the page first renders (controlled by the RefreshCondition).
The method is correctly executed, but you see it's executed twice.
The Log window of JDeveloper shows:
Hello World
Hello World 

Cause

The property Refresh is not defined for the invokeAction.
Its default value is ifNeeded, what means that the related action binding will be invoked twice during each request.


Solution


You should change the default Refresh setting for the invokeAction bindings to either prepareModel or renderModel.
With prepareModel, your invokeAction will be invoked before the JSF invokeApplication phase.
With renderModel, your invokeAction will be invoked after the JSF invokeApplication phase.

Since JSF's invokeApplication phase is when the JSF action events fire, you should decide if you want your invokeAction to trigger before (prepareModel) or after (renderModel) the action listeners have performed their processing,

For more information, see the ADF Develoepr's Guide, topic "10.5.5.3 Correctly Configuring Refresh Property of InvokeAction Executables"


April 2, 2008

How To Avoid The JBO-27014 Error During The AutoSubmit


When your ADF Faces page includes a component with the property autoSubmit set to true, you get the following error:

JBO-27014: Field <fieldName> in <AppModule>.<ViewObject> is mandatory

for a component with the property immediate set to true.

This happens f.ex. when you try to populate a Description field as soon as the end user typed the Code value.

This error is raised because of the immediate on the component, what implies that the component's value will
be validated before any input components that do not have the immediate
attribute set to true.
At the time of the validation, this component hasn't got its value yet and the error is raised.


You can easily workaround this problem as the following:

  1. in the backing bean, add a boolean variable ppr true when a Partial Request occurs:
    (...)
    import oracle.adfinternal.view.faces.renderkit.core.xhtml.PartialPageUtils;
    (...)
    private boolean ppr;
    (...)
    public void setPpr(boolean ppr) {
       this.ppr = ppr;
    }

    public boolean isPpr() {
       FacesContext fctx = FacesContext.getCurrentInstance();
       return PartialPageUtils.isPartialRequest(fctx);
    }
    (...)

  2. use it in the required property of the mandatory field:
    <af:inputText ...
                  required="#{! backing_validation.ppr}"
                  immediate="true" ... />

January 31, 2008

Lookup Fields


A regular request from former Oracle Forms and Designers developers is how to program lookup fields.
Suppose f.ex. a page displaying an Employee (SCOTT.EMP), including a field Deptno that automatically refreshes a field Dname when updated:

Lookup:

This can be done declaratively in ADF. I added Samples 6 that shows it.


January 24, 2008

Selecting Multiple Rows in a Table With af:tableSelectMany


It's already a while I put this sample in my Sample Applications page, but I see I never announced it on my Blog.

I created Sample 5 including a page with a table and an af:tableSelectMany component.
You can select several employees and click the button "Increase Salary":
TableSelectManyIncrease1:

The salary of the selected and ... lucky ... employees will be increased by 10%:
TableSelectManyIncrease2:

February 26, 2007

Setting the First Day of the Week to Monday in the SelectInputDate component


Jose asks in the OTN Forum how to set the first day of the week in the <af:SelectInputDate> component.
For example, suppose that you set up the preferred language of your Browser to French/Belgium [fr-be].

The calendar will show the following days: dim., lun., mar., mer., jeu., ven., sam. for Sunday, Monday, Tuesday, Wednesday, Thursday and Friday respectively:
CalendarInFrench:

However, in Belgium, as in many other European countries, the first day of the week is the Monday and not the Sunday.
So the calendar should display: lun., mar., mer., jeu., ven., sam., dim.  instead.

Is it possible to change this in ADF Faces ?

Unfortunately, it's not possible in the current release of JDeveloper.
This will be possible from JDeveloper 11 onwards (Enhancement Request 5653036 for those who have access to Metalink), where the chooseDate component will take the locale into account to display dates (and also numbers).
For more information, see "Add support for formatting locale, separate from translation locale".

Diagnosing Problems with the Visual Editor Not Rendering JSF Pages.


In a previous post, I blogged about some ADF Faces Pages that didn't render correctly - see "ADF Faces Pages under WEB-INF Directory Do Not Render Correctly in 10.1.3.1".

I also had another customer reporting the problem, though the pages were created outside the WEB-INF directory.
In his case, the Visual Editor was showing a blank page as the following:
TuhraBlankVisualEditor:

To diagnose such issues, you can first launch JDeveloper with the Console window opened, by executing <JDEV_HOME>\jdev\bin\jdev.exe (not jdevW.exe).
Repeat the operation and check if the Console displays a Stack Trace.
Unfortunately, it didn't help in this case.

The next step is to change a preference in JDeveloper:

Select menu Tools -> Preferences...
In the left pane, select JSP and HTML Visual Editor
There select the check box Show Design Time Messages in Log.
This preference controls whether design time errors display in the Log window.
 
Restart JDeveloper and open the page again.
In this case, we got errors in the Log window:

Failed in contextInitialization  : class com.sun.faces.config.ConfigureListener
java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester
    at com.sun.faces.config.ConfigureListener.digester(ConfigureListener.java:964)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:270)
    at oracle.jdevimpl.webapp.design.support.http.DesignTimeServletContainerContext.contextInitialized(DesignTimeServletContainerContext.java:978)
    at oracle.jdevimpl.webapp.design.DesignTimeThread.invokeContextInitialized(DesignTimeThread.java:712)
    at oracle.jdevimpl.webapp.design.DesignTimeThread.synchronousUpdate(DesignTimeThread.java:163)
    at oracle.jdevimpl.webapp.design.DesignTimeDocumentContext._init(DesignTimeDocumentContext.java:1477)
    at oracle.jdevimpl.webapp.design.DesignTimeDocumentContext.<init>(DesignTimeDocumentContext.java:247)
    at oracle.jdevimpl.webapp.design.DesignTimeEngine.start(DesignTimeEngine.java:242)
    at oracle.jdevimpl.webapp.editor.jsp.JspEditor.startupDesignTime(JspEditor.java:307)
    (...)

With this information, the cause of the problem is more obvious.
While trying to render the JSF page in the Visual Editor, JDeveloper doesn't find the class Digester in the libraries of the project and a NoClassDefFoundError is raised.
This class is included in the library Commons Digester 1.5 (<JDev_Home>\jakarta-taglibs\commons-digester-1.5\commons-digester.jar)
A quick look at the libraries of the project showed us that this library was missing:
TuhraMissingLibraries:

By comparing another ADF Faces project, we could see the following libraries were missing
  • Common Beanutils 1.6.1
  • Common Digester 1.5
  • Common Logging 1.0.3
  • Common Collections 2.1
To fix the issue:
  1. Double-click your Project to access the Project Properties
  2. Select Libraries in the left panel
  3. click button Add Library...
  4. select the 4 missing libraries
    TuhraAddLibraries:
  5. click OK twice to close the 2 dialogs.
After these changes, the libraries showed up as the following:
TuhraExpectedLibraries:

and the page (the Tuhra template in this case) could render correctly in the Visual Editor:
TuhraTempla:

February 7, 2007

NoSuchMethodError - AdfFacesContextFactory.createContext


Mauro reports the following problem on the OTN Forum:
Running the application from "Introduction to ADF Faces/Trinidad Using JDeveloper" on OTN, migrated from JDeveloper 10.1.3.1.0 to JDeveloper 10.1.3.2.0 fails with the following error:

500 Internal Server Error

java.lang.NoSuchMethodError: oracle.adf.view.faces.context.AdfFacesContextFactory.createContext (Loracle/adf/view/faces/webapp/wrapper/ContextWrapper;Loracle/adf/view/faces/webapp/wrapper/RequestWrapper;)
Loracle/adf/view/faces/context/AdfFacesContext;
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterHelperImpl.startFilter(AdfFacesFilterHelperImpl.java:112)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:111)
    at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
    (...)
Problem is caused by the fact the adf-faces-api.jar JAR file, in the ...\View\public_html\WEB-INF\lib directory of the application is not migrated to the new release.

To fix this issue, you can manually copy file adf-faces-api.jar from <JDev10.1.3.2_Home>\jlib to the application directory ...\View\public_html\WEB-INF\lib.

I informed our Development team about the issue as the same problem was already reported in the previous release, but should have been fixed in 10.1.3.2.0, what's apparently not the case.

I'm still investigating the issue: normally, adf-faces-api.jar is referenced from the "ADF Faces Runtime" library and is no more part of the ...\WEB-INF\lib directory. However, it seems that some of our examples on OTN still include this JAR file (I have the same problem with the ADFFaces_skin_sample).

February 1, 2007

How To Specify a Second Date Pattern in ConvertDateTime


2 customers asked me this week how to specify a second date pattern for an af:selectInputDate

(...)
<af:selectInputDate value="#{bindings.Hiredate.inputValue}"
                    label="#{bindings.Hiredate.label}"
                    required="#{bindings.Hiredate.mandatory}">
   <af:validator binding="#{bindings.Hiredate.validator}"/>
   <f:convertDateTime pattern="#{bindings.Hiredate.format}"/>
</af:selectInputDate>
(...)
Note the f:convertDateTime with the pattern attribute that will pick the Date format pattern you specified at the Entity Object level (or View Object).

This is not possible directly with the JSF Core <f:convertDateTime>.
However, this can be achieved with our own implementation <af:convertDateTime> that includes a property secondaryPattern,
that will be used as a second attempt to parse a string representing the date, if the primary pattern fails:
(...)
<af:convertDateTime pattern="#{bindings.Hiredate.format}"
                    secondaryPattern="ddMMyyyy"/>
(...)

For more information about the <af:convertDateTime>, click [Here]
Your entry in the Pattern and SecondaryPattern should respect the pattern syntax specified by the java.text.SimpleDateFormat.
You can test your pattern is valid in http://www.fileformat.info/tip/java/simpledateformat.htm
 

January 22, 2007

Table Range Not Reset After Query


A customer contacted me with the following problem:
he created an ADF Faces page where
the end-users can enter a query criterion, say a Department Number, and display
the Employees from this Department in a Read-Only Table.

Dept10_Range2:


The application works fine.
However, they reported the following problem:
they can navigate to another Range in the page, to scroll through the employees of the department, as shown in the figure above, where the second Range (record 3) is displayed (I set the RangeSize to 2 in this sample).

Then they query another department, say 20.
Employees from this Department are shown - that's correct.
However, they were expecting the table to show the first employees of the Department 20.
It doesn't: the table Range stayed at the same position as it was before the new query was executed:

Dept20_Range2:


To fix this problem, you have to add the following code in your backing bean:

public String resetRange() {
   getEmpTable().setFirst(0);
   return null;
}
where table.setFirst(0) sets the index of the first row in the currently range of rows to the first record in the Table.

and set the property action of your commandButton to call this code:

<af:commandButton
   text="Query"
   (...)
   action="#{yourBackingBean.resetRange}"/>

I've added example # 4 in my Sample Applications page. It includes a page showing the problem, and another one including the workaround.


December 4, 2006

Example of Using a selectBooleanCheckbox for VARCHAR2 or NUMBER Columns


I've added example # 3 to illustrate how to use an <af:selectBooleanCheckbox> bound to VARCHAR2 or NUMBER Oracle Database columns.
This is performed by creating a transient attribute of type Boolean and redefining its getter and setter methods to 'translate' the ADF Business Components type Boolean to the 'standard' String or Number types that the Oracle Database "understands".
(Boolean is not a valid type in the Oracle Database).

November 22, 2006

ADF Faces Pages under WEB-INF Directory Do Not Render Correctly in 10.1.3.1


Some readers of the "Oracle JDeveloper 10g for Forms & PL/SQL Developers" informed me they had some problems with the Hands-on Practice of Chapter 11: Create the Home Page and Menus, section III.
Create a Template.
At page 344, under Add Components to the Template, step 1, after the drag&drop of the PanelPage on the h:form tag, the Visual Editor should normally
display the template page as the following:

Tuhra101304:

This is how the
page displays when doing the practice in JDeveloper 10.1.3.0

However, when using JDeveloper 10.1.3.1 the ADF Faces components do not render correctly:

Tuhra101310:

Closing and reopening JDeveloper as proposed in the NOTE at page 345 doesn't help.

This problem happens for all ADF Faces page you create in WEB-INF directory or in any of its sub-directories, f.ex. ...\WEB-INF\template\
We reported the issue in Bug 5665931 (*) - JSF PAGES CREATED IN SUB-DIRECTORY DON'T RENDER CORRECTLY IN THE VISUAL EDITOR
(*) requires an account on MetaLink.

However, Steve Muench points out that the problem is related to a change in the JavaServer Faces reference implementation version 1.1_02, as documented in the JDeveloper 10.1.3.1.0 Release Notes:

JDeveloper 10.1.3.1 upgrades to the JavaServer Faces reference implementation
version 1.1_02. This maintenance release of the JSF runtime from Sun introduces
a new restriction preventing the processing of any JSF page located in the ./WEB-INF
directory (or subdirectory thereof). If your JSF applications contain pages
in the WEB-INF directory, you will need to move those pages to another directory
under the web root other than WEB-INF for them to function correctly. If your
JSF pages use ADF Model data binding, after moving the JSP/JSPX pages from ./WEB-INF
(or subdirectory) to a new directory under your web root, you will need to reflect
the change in the "path" value inside the <pageMap> section
of your DataBindings.cpx file. For example, if your page previously had a "path"
value of "/WEB-INF/page/Test.jspx" and you moved this Test.jspx page
to ./public_html/page/Test.jspx -- where ./public_html is the HTML root directory
of your view controller project -- then you must edit the value of the path
and change it from "/WEB-INF/page/Test.jspx" to "/page/Test.jspx".

To avoid the issue, you can
  • either use JDeveloper 10.1.3.0
    [it can be downloaded from OTN; ensure you select Oracle  JDeveloper 10g (Version 10.1.3.0, build 3673)]

  • or you can store the template somewhere else than under WEB-INF.
    "The only reason for putting it there is so that it is not directly runnable. You can
    avoid this issue by not deploying the template file if it was elsewhere
    in the directory structure." (Thanks to Duncan Mills for his comment).
See authors' comment on their site in the Errata section.

October 23, 2006

Migrating ADF Faces Applications to JDeveloper 10.1.3.1 Production (2)


I already blogged on problems after migration to JDeveloper 10.1.3.1  Production.

Jan Vervecken reports other issues on OTN: "10.1.3.1 : Skip navigation elements to page contents"

The problem

ADF Faces pages including an af:panelPage component.and migrated from JDeveloper 10.1.3.1 Developer's Preview (Build 3914)
to JDeveloper 10.1.3.1 Production (Build 3984) display the following error:
Skip navigation elements to page contents
at Design Time in the Visual Editor:

DT_10131_Production:

The same error is displated at Runtime.
Furthermore, the look-and-feel of the page isn't correct (incorrect styles):
RT_10131_Production:

The Solution

The solution consists of deleting the file ...\WEB-INF\temp\adf\styles\cache\oracle-desktop-10_1_3_1_0-en-ie-6-windows-s.css
The next time you reopen the page in JDeveloper, it will display correctly.

References

(require a MetaLink account):
  • Bug 5616568 - MIGR: "SKIP NAVIGATION ELEMENTS TO PAGE CONTENTS"
  • Note 396255.1 - ADF Faces Pages Migrated from JDev 10.1.3.1 Preview Displays Message: "Skip navigation elements to page contents"

October 22, 2006

Migrating ADF Faces Applications to JDeveloper 10.1.3.1 Production


As explained in my previous post "JDeveloper 10.1.3.1 Production", there are known problems with the migration of ADF Faces applications to JDeveloper 10.1.3.1 Production.

My initial testings were done with a migration from JDeveloper 10.1.3.0 to JDeveloper 10.1.3.1 Production.
The fix was to copy the right version of jsf-impl.jar to your project directory .../WEB-INF/lib

However it appears that the migration from JDeveloper 10.1.3.1 Developer's Preview (Build 3914) shows different symptoms and requires another fix (copy adf-faces-impl.jar).
See the following OTN Forum threads:

I updated my previous Blog post and Note 395980.1 on MetaLink..


July 27, 2006

Reset button doesn't empty fields


The <af:resetButton> component: doesn't empty the fields after a Form was submitted.
Instead, it reverts them to their values right after the last Form submission.

If you want to empty the values in the Form elements, you have to use JavaScript.

Suppose a JSF page with a field identified as 'username':

<af:inputText label="Username" (...) id="username"/>

The following example nullifies it
 function resetFields() {
   document.forms[0].elements['username'].value='';  
}

A more generic JavaScript function, working for all fields in a Form, but also for other types of widgets (list & checkbox) could be:
function moreGenericResetFields() {
   for ( i=0; i < document.forms[0].elements.length; i++) {
      if ( ! ( document.forms[0].elements[i].readOnly  || document.forms[0].elements[i].disabled) ) {

         if (( document.forms[0].elements[i].type == 'text' ) || ( document.forms[0].elements[i].type == 'textarea' ) || ( document.forms[0].elements[i].type == 'password' )) {
            document.forms[0].elements[i].value = '';
         }

         if ( document.forms[0].elements[i].type == 'checkbox' ) {
            document.forms[0].elements[i].checked = false;
         }

         if ( document.forms[0].elements[i].type == 'select-one' && ( document.forms[0].elements[i].length != 0 )) {
            document.forms[0].elements[i].options[0].selected = true;
         }

      }
   } 
}
You can save the JavaScript function in a file, eg utils.js and reference it from a <script> tag in the <afh:head>:
(...)
<afh:head>
  <script src="utils.js" type="text/javascript"></script>
  (...)
</afh:head>
<afh:body>
  (...)
  <af:inputText label="Username" (...) id="username"/>
  (...)
  <af:commandButton text="Reset Via JavaScript" onclick="resetFields()"/>
  (...)
</afh:body>
(...)

I've added example  #2 in my sample page.

July 24, 2006

ADF Faces: Submit a form with the Enter key


Frank explains how to submit a form with the Enter key on his blog.
He works with the standard JSF h:form component and creates JavaScript code to handle the Enter key.

Another solution, that doesn't require Javascript coding, is to use the af:form
It contains a property defaultCommand where you can specify the id
attribute of the command button whose action will be invoked by
default for form submit on hitting ENTER on any of the input fields of
the form.

See the detailed explanation [Here]

June 21, 2006

Browsing and Editing/Uploading Database Images in JSF

We had several requests in Oracle Support this week for an example of browsing and editing/uploading images in a JSF page.
Steve added example # 69 to his samples page.
In his example, the images are saved in a column of type ORDImage (Oracle Intermedia type).

June 12, 2006

ADF Faces Project Renamed to Trinidad

Jonas announced on his Blog today that ADF Faces project (donated to Apache) was renamed Trinidad.

See "Long live Project Trinidad a.k.a ADF Faces!!" for more information.

May 19, 2006

ADF Faces Core and ADF Faces HTML missing from Component Palette

I have a strange problem from time to time, while working with a JSF page in JDeveloper:
I cannot see the palettes ADF Faces Core and ADF Faces Html from the drop-down list in the Component Palette anymore, and the Faces tags are not displayed correctly in the Visual Editor.

It works fine again after I close and restart JDeveloper.
See this article for more detail.

March 31, 2006

Warnings when running a JSF application

Warnings are shown in the JDeveloper Log window when running JSF applications:

Target URL -- http://localhost:8988/YourApplication-context-root/faces/YourJSP.jsp
08-Mar-2006 16:19:05 com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.Short,null)
(...)
08-Mar-2006 16:19:05 com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.Number,null)
2006-03-08 16:19:08.673 NOTIFICATION ADF Faces is running with time-stamp checking enabled. This should not be used in a production environment. See the oracle.adf.view.faces.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml
This is java.util.logging stuff and you can ignore them.
You can edit your logging.properties in /jdk/jre/lib/logging.properties and change the following line
java.util.logging.ConsoleHandler.level = INFO
by
java.util.logging.ConsoleHandler.level = SEVERE
if you want to avoid all these warnings.

Concerning he message:
2006-03-08 16:19:08.673 NOTIFICATION ADF Faces is running with time-stamp checking enabled. This should not be used in a production environment. See the oracle.adf.view.faces.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml   
it will only happen in the embedded OC4J and will disappear when the application is deployed in an Standalone OC4J or in iAS, unless you explicitly switch the feature on.

Development is aware of these warnings and I hope they will be able to remove them in a future release as this bunch of warnings is not informative and confusing.

About Faces

This page contains an archive of all entries posted to Didier's Blog in the Faces category. They are listed from oldest to newest.

EJB is the previous category.

Firefox is the next category.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle