Thursday, December 17, 2009

default database values

If you get an error that indicates that ADF/BC (the version out of JDev 10g) has compared the value it originally retrieved from the database to the value now in the database, and finds that they have changed; please, bear in mind that a database default value will do this on new records also!

So for example: you are now editing a record that you just created, suddenly you get this jbo error on a postback. The ADF Developer's Guide... says that in the case of columns altered by triggers associated with an insert, that you will need to check the "update after insert" checkbox in the entity for that attribute. The documentation does not specifically mention database table column default values, but these will have the same effect.

Once you realize this is what is happening you need only check these checkboxes to fix this.

Monday, December 14, 2009

Just updated my blog profile

I just updated my blog profile to have a valid email address. I forgot that the one in there was not valid, since I am not job-hunting at the moment.

Sorry if it has caused me to give the appearance of ignoring anybody's questions.

Friday, December 11, 2009

adding 1 or more blank rows to your af:table for data entry

Boy am I embarressed. I read the whole 1160 ADF 10g developers guide for 4GL developers from Oracle, have professional experience with building ADF, and claim to be becoming an expert in all this stuff.

But I had failed in getting this simple thing done before successfully: have more than one rows availble in an af:table to allow data entry. I kept running into trouble with validation on the second row. I knew how to do what I wanted in Oracle*forms, just not ADF/BC/ADF Faces!

To my credit though I am sure I must have inquired of the JDev Forum at least once before on this subject. Literally I had come up with an "alternative" solution on a prior contract, but it was WRONG!

The correct solution is very simple: like it says in the manual: whenever you do a VO.create(); follow that by taking the resulting row and saying resultingRow.setNewRowState(Row.STATUS_INITIALIZED);

Then you can VO.insertRow(resultingRow), or do whatever you want.

The odd part of this is, I guess, if you have overridden your initDefaults in the VO's entity, using the entity's setters may changed the status of this VO row from STATUS_INITIALIZED to STATUS_NEW. I kinda figured that if you have setter method calls (e.g., this.set...(blah))in that method that you would not "dirty" your row or entity. I guess that is not right.

At any rate: that's how it is supposed to be done.

So embarressed.

Sunday, December 6, 2009

The proper tool for the job

My grandpa used to say, "The proper tool for the proper job!" I knew what he meant, and it seemed to apply to what I was experiencing yesterday.

I am using some Dojo widgits to get ADF Faces (JDev 10g/Trinidad) some extra functionality. It integrates pretty well. The way I am doing the integration each widgit I use requires a hidden field in the background. But I think there is a caveat. There is something that does not work right in some JavaScript I am using so that the integration code does not work right if there are only af:inputHidden's on the screen, and no actual input fields...just the dojo widgits providing that function. In other words there still needs to be at least one inputText for the dojo integration to work right. No problem, I just made my first dojo integrate with an af:inputText with a style of "display:none;". Works fine normally.

Well yesterday and the day before it was NOT working fine. I was imagining a SIMPLE use-case whereby I had several Dojo rich text editors on the same page. I thought: I will just bind the value of my hidden af:inputText to a backing bean getter/setter that just pulls the data it needs from the database when it needs it and caches it when possible on a session bean HashMap to avoid needless trips to the database.

I typed out some code how I imagined it would work...that was 3 working days ago!

Since then, trying to make af:inputText work, knowing what I know, I think I have encountered every caveat know to man related to using af:inputText and not binding to the database with ADF bindings. For one thing my setter would not fire! The processing would go through the motions like it WANTED to fire (i.e., it was firing "isReadOnly()" in the PropertyResolver when it was trying to evaluate my value binding. The only reason I know of to fire isReadOnly() is to test for fitness for doing a set, and every call it made returned "false", so I kept waiting for the setter to fire. It did not!

So I started thinking of alternatives. I thought: maybe I can use a valueChangeListener. It turned out that either the presense of the value binding or perhaps references to the binding layer (not for a value but just for VO attribute metadata purposes, like getting a value for required property) was diabling my use of the valueChangeListener, so I had a hard time even getting that to fire. When I got it to fire, it was without the value binding. So I switched to bind to an input component in my backing bean.

The nice thing about my original plan is that the getting and setting happens at all the right time, and since my af:inputText was inside an af:iterator loop, I need access to the requestScope "var" variable generated each loop. Using the getters and setters I had the perfect alternatives. But since that was not working out so well, I now was trying to figure out how to use this component I was bound to that is going through the ringer anyway to populate it. I was imagining that I would ultimately need a custom component that would give me the control I needed to be able to fire things at the right time so that I could hit the database for the values I wanted in time to use them as Dojo was loading, and also be able to save them back if someone updated the Dojo widgit.

Anyway, I was really not looking forward to going down that road, so after doing a few more experiments, I finally tried using h:inputText and going back to my original plan.


I was grateful; I did not have to slit my wrists after all! It worked so beautifully that I literally just connected up that code I created initially for the getter and setter, and everything worked according to plan, just like I had imagined.

I think the lesson I learned was, if you are going through ADF binding layer, there is probably no better solution than using af:inputText, and the like. And if not...if you have a simple JSF usecase that does not seem to fit the ADF Binding scenario, maybe you are (or at least, I am) better off using good old JSF components for simplicity and predictability sake.

One thing in my career I am trying to obtain is some depth and breadth to my knowledge. I think yesterday helped me obtain that just a bit more.

Wednesday, November 18, 2009

Job posting

We are looking for a new addition to our team out in Fairfax, VA, to help out with ADF work. We are trying mightily to convert an old web-pl/sql toolkit/portal system to ADF Faces. Right now our target for conversion is the ADF Faces (JSF 1.1) which comes with JDeveloper 10.1.3.x. We are deploying to OC4J/iAS

Ultimately we would like to get to ADF Faces Rich Client (JSF 1.2) version, but that is contingent on resolving some licensing issues.

So, if you know ADF/JSF/J2EE/Java EE/Java/JSP and are looking for work in the Fairfax, VA area please contact me at michael_fons at yahoo dot com.

Limited telecommuting might be possible, but more than likely you would be commuting (like me) or moving to this area on some basis.

U.S. Citizenship required.

There is also some BI reporting work to do as well, so if you know BI or Pentaho that would be a plus.

Wednesday, October 28, 2009

What to study next...

So many technologies I want to study further: JSF 2.0, GWT, ADF Faces Rich Client component library, deployment of Java EE apps to phones and pda's, Scala, Wicket, Tapestry, Facelets, et cetera ad nausium. little time. I wish we could learn like they did on the matrix :-)

Monday, October 19, 2009

Oracle Open World Aftermath

I definitely owe a blog entry at this point!

Just came back from Open World, and boy: is my brain tired!! (ba-dum-CRASH)

Anyway. I had a request that I make some specific entries on my blog from someone in the audience that came up to visit after my presentation.

He wanted to know how to do two things that I mentioned:
1. how to use the phase listener to get resource files in a custom component, and
2. how to use a renderer to divide up functionality.

These are somewhat meaty topics but I will try to be concise.

I. PhaseListener "magic"
If you have Schalk and Burns's
JavaServer Faces: the complete reference then just (re)read Chapter 11.

If you do comes the paraphrase. The general idea is that you need to add a phase listener to your application in the normal manner: by adding a few lines to your faces-config.xml file. Note that if you have a custom component in JSF, then your jar has in it in its META-INF directory a faces-config.xml file, where you can reference this phase listener. JSF guarentees that this will be read first before the one in your application, I believe, provided this jar is in your WEB-INF/lib directory of your application.

Anyway you take your added phase listener, and make it listen for the RESTORE_VIEW phase by overriding the getPhaseId() method, and returning PhaseId.RESTORE_VIEW constant.

So let us say for example that your component has a need to have javascript code, that you want to keep in a sepparate file...because there is too much code to render on the html page itself (or you are a "tidy" individual). So your component will encode/render a javascript "include" (i.e.,<script src="somename" type="text/JavaScript"></script>

). So you encode this line onto the page. Then when this page is "interpreted", and issued as a request, your phaseListener can be ready. Your phaseListener has knowledge that at some point after the RESTORE_VIEW phase is complete, the FacesContext.getViewRoot().getViewId() will contain "somename". At that point, the phase listener can use getClass().getResource("somename's filename"), to get a url. This url can be connected-to and read from, an inputStream, then an inputStreamReader, then a BufferedReader. Meanwhile you open the outputWriter from the response on the FacesContext's ExternalContext, create an outputStreamWriter, then do a while loop reading lines from the buffered reader and writing lines to the outputStreamWriter, until there are no more lines to write. By the way the FacesContext is available from the PhaseEvent that your receive as a parameter. And with this FacesContext, you finish with a call to its responseComplete() method.

II. Renderer.

This is easier. If you have a custom component that has no renderer you can move your encode*() methods and decode() method to the a custom Renderer class. The main changes you will need to make are because you now no longer say "this" when you need to reference your component. In your new renderer class (which BTW extends "Renderer") the encode*() and decode methods receive your component as a parameter, so you much change your "this" references to use this parameter.

You must also augment the faces-config.xml, to have a element with a sub-element which shows the family, type, and class of your renderer. Type can be anything, but whatever it is must now also be returned by getRendererType() overridden method in your tag handler class.

Also you will need to guard against receiving a null FacesContext or a null Component value for your parameters. This is in the spec so don't shoot me; I'm just the messenger.

Sir, I hope, whoever you said you were, that this blog entry, approaches meeting your custom-component writing needs or curiosities, or whatever drove your question. I bid you: good day!

I bid the same for the rest of you as well.

Wednesday, September 16, 2009

New slideshow uploaded to slideshare

Check out my new slide share presentation on JSF Custom Components that I will be presenting for Oracle Open World 2009...if you go to the slideshare site you can download the ppt and get the notes that go with the presentation.

You can also download the powerpoint by pressing the Menu icon on the bottom left of the embedded slideshare image below, and selecting Download in the context menu.

Or view the presentation below without the notes...

Thursday, August 27, 2009

ADF Faces (Trinity): af:forEach and af:table...think twice

Rule of thumb: be careful of using af:forEach in af:table rows to generate the options of a select list. Much safer to use getter to get a list and plug into value of f:selectItems (plural), than to use f:selectItem (singular) and use af:forEach to iterate over. af:iterator might work instead of af:forEach, too, but I am not sure.

Also mixed in with this was using forEach's varStatus property...something I have had bad luck with in the past.

Basically what was happening, was this forEach was not even on a part of the screen that was getting rendered, but it was causing components to render multiple times and get all mixed up. Pretty hard to track down.

So in this particular case I would get this doubling when I used the following inside of an af:selectOneChoice...

<af:forEach begin="1"
<f:selectItem itemLabel="#{priorityLoop.index}"

...instead of using someting like the following...

The use-case for this problem was a bit odd, but nothing too bad...

Sunday, August 23, 2009

af:menuBar selected style

If you want to use af:commandMenuItem inside an af:menuBar, with the af:commandMenuItem's selected property set to a particular value (true, false, EL), that is great. Just remember you cannot embed your af:commandMenuItem inside some other component and have this selected work...even if that other component is embedded inside an af:menuBar component. The CSS that is generated by the skin selector for the af:menuBar for this purpose is picky about how it wants to see things: td. a

Wednesday, August 19, 2009

speaking at NoVAJUG

If you live/work in Virginia, I will be be giving a preliminary viewing of my Oracle Open World presentation on JSF Custom Component basics.

Here is more info on the matter:

Also here is the NoVAJUG website:

Tuesday, August 18, 2009

view links internal to sql statement

There is an esoteric aspect of links that I had not really experimented with until yesterday.

First know that it is possible to write a query/view object, that contains a bind variable in the query which is not defined in the list of bind variables in the view object itself.

Why would you want to do this?

What if you wanted (for speed reasons) to put a bind variable referencing a parent query column in a subquery of a query in the child view object?

Well, if you create a view link between the parent and child queries, ADF will automatically create a bind variable on behalf of the view-link with the name "Bind_. So if the parent was DeptView, and the child EmpView, and their connecting view link was DeptView.DeptNo = EmpView.DeptNo, then at run time this view link would create :Bind_DeptNo referenceable in the child query. So you could put this in a sub-query.

At the moment this still leaves the sometimes problem that you may have to have a connecting DeptNo in the child query select clause, but that is only a problem in some cases. This bit of flexibility can be good enough in many cases.

Also this may be a case where the problem is that I am not sure just how much more flexibility ADF/BC will allow. It is quite possible that you could connect these two queries based on bogus columns like select 1 bogus_columnn, ... from ... in both the parent and child, and then change the where clause in the view link to join on :Bind_DeptNo. Maybe it is even more flexible than that; I just am not sure at this time.

Tuesday, August 11, 2009

af:treeTable: getting at a clicked node


I was working with an af:treeTable and its accompanying tree binding. I wanted to click a node to open it (if that node had sub nodes) and then automatically do something with the data in that node. I did not want to have to click on a link in the tree to identify the node.

Here is what I came up with:

public void onDisclosure(DisclosureEvent disclosureEvent) {
CoreTreeTable cmt = (CoreTreeTable)disclosureEvent.getSource();
PathSet ps = cmt.getTreeState();
Set ks = ps.getKeySet();
// The key-set is the set of addresses of keys that are open.
// Clearing it closes all that are open.

List rwKey = (List)cmt.getRowKey();
// The row-key is the address of the row that was just disclosed/clicked.
// It is a list of Strings, which contain 0-based numbers.
int depth = 0;
for (Object o1 : rwKey) {
ArrayList pathToAdd = new ArrayList();
for (int i = 0; i < depth + 1; i++) {
// This for loop just added the address of the node clicked,
// to the set of "open" nodes. Along the way it also enters
// all the parent node addresses as well, creating a new
// array list to store the address for each ancestor as well as
// the node clicked.

// I want to get the node that was clicked. I should be able to
// use the row-key to traverse the tree model to get the node I want.
TreeModel lTreeModel = (TreeModel)cmt.getValue();
Object lRowData = null;
for (Object lRowKeyIndexObject : rwKey) {
// Can I assume I start out with the tree model looking at root
// node?
String lRowKeyIndexString = (String)lRowKeyIndexObject;
int lIndex = Integer.parseInt(lRowKeyIndexString);
if (lTreeModel.isRowAvailable(lIndex)) {
lRowData = lTreeModel.getRowData(lIndex);// JUCtrlHierNodeBinding
if (lTreeModel.isContainer()) {
// When the loop is over the tree model should be
// set to the level and row that was clicked.
// Also lRowData should be the row we care about...the
// clicked row.

// We do not have to reset. I think each request the tree model
// resets. Traversing the tree model does not affect the way
// the tree table renders or looks.

JUCtrlHierNodeBinding lNodeBinding = (JUCtrlHierNodeBinding)lRowData;
String lNodeContents = (String)lNodeBinding.getAttribute(1);
// Display the found node.

// Next experiment. Create binding in query
// and a field that allows you to set this binding.
// See if when you open a node if it affects any others nodes
// or not.

Wednesday, July 22, 2009

tomahawk t:popup component

If you have to remember something about the t:popup component: remember this: if you use it on a af:commandLink (or some command component...something that submits) and you click on that component, you will get an error when your page reloads (due to postback), if you are running on IE 6 or 7. "...Operation aborted"

The cause of this error seems to be that you are trying to run javascript before the DOM is all the way loaded.

It also seems to mess up the wysiwyg editor in JDeveloper 10g, but I can kinda get used to that...for what this popup component brings to the tables. It allows you to hover over an element and get a popup which will stay open until you leave it. Or you can make the popup go away when when you leave the driving element.

Anyway...everything is peachy in IE 8 and in the latest version of Firefox. :-)

Tuesday, July 21, 2009

web.xml minutiae: SecurityContext.isUserInRole()


If you are using Oracle SSO, iAS 10.1.4 infra, iAS mid-tier, and running ADF on it, and Oracle Portal on another is some information that may come in handy for you:

  1. In ADF if you use isUserInRole() method in the SecurityContext, you will need to bounce your 10.1.3 instance every time you make a change (or a set of changes) to the OID users and groups/roles. I imagine there is a way to get my 10.1.3 to refresh from the oid explicitly, but I have not figured it out yet.
  2. isUserInRole also expects that particular roles that you are testing to be listed in web.xml. So just because the user has the role in OID does not mean you can test for it must first add it to web.xml.


Tuesday, July 14, 2009

Custom Components in JSF and af:iterator

I have something to report that I did not realize about custom UI components in JSF (lots of things probably...)

Consider the following scenario: you put a custom component in a af:iterator component. Can you answer the following questions?
  1. How many instances of your custom component that you included in that af:iterator loop will be created?
  2. If your component's function is to print a different kind of input field or widget depending on the parametric input given to the component tag, what might you need to do with any attributes in your component?

The answer to 1 is: one. One for each af:iterator. So if your iterator loop brings back 1000 records from the database, it loops 1000 times and "prints" your component 1000 times, but there is ever only one instance of the component.

For question 2...let us say that your component offers the printing of 4 different kinds of components depending on the value of its "type" tag attribute. So in that page you will have 1000 fields printed one for each af:iterator loop. If your component only rendered UIOutput components then it would suffice to have one property in your component class for each type of component.

But we are doing input components, so decode will be involved. That complicates things. JSF will generate a client id for each field that you generate with your component. If it is in the af:iterator loop it will look something like: formname:iteratorname:n:yourcomponentid -- where n is the zero-based loop index of your af:iterator.

On a JSF postback/decode, each field first runs the decode method. Then each field runs the encode methods for the component. In between the decode runs and the encode runs you need to store the submitted value of each component. I used a HashMap with client id as the key, and the component as the value. If you store everything away in decode you will have whatever you need to do the encode when it occurs for the postback.

Hope this helps someone.

Wednesday, July 8, 2009


I was trying to use af:forEach with a custom component I made. This custom component is a bit like the declarative components in ADF Faces Rich Client components, in that it renders different components depending on what type you send it. I was trying to pass a value binding through an attributes and then trying to evaluate the value of this in the component at encode time, but the af:forEach request scope "var" variable could not be evaluated by the property resolver. af:iterator, I am happy to say, for some reason did something different however so the "var" was more accessable to the child custom component.

There was another project also where af:forEach really was acting up, where I wish I had known about af:iterator.

The inspiration to try this component came from Duncan Mills blog entry

Wednesday, June 17, 2009

f:verbatim's affects on af:inputText

Did you know if f:verbatim is a parent of af:inputText that the af:inputText will ignore changes made by the end-user to its data??? That one drove me a little nuts. I am trying to integrate Dojo with ADF is why I ran into such a scenario.

Oracle Open World 2009 Campaign

Thank you so much for your votes on my Oracle Open World presentation proposals. Many heavy hitters in the ADF community have voted for this presentation. It is on JSF Custom Components: Frank Nimphius, Grant Ronald, Peter Moskovits, and the list goes on and on.
I have noticed that Oracle Mix has been a bit flaky at time for the links that I distributed. If you wanted to vote but could not see the links, please try the proposal page; you should have better luck. At this time I am on the second page of Top proposals:
I am very excited to be involved with this campaign. :-)
Michael Fons

Hi. I want to speak at Oracle Open World 2009. My paper is on creating JSF Custom Components.

Please read my abstract and vote for my paper at

Note: in order for your vote to count, you will need to ...
1. Have/log into an Oracle Mix account (follow the appropriate links if you don't already have an Oracle Mix account; good site to check out, anyway)
2. Vote for at least 3 papers.

To help with 2. above, please also vote for a friend of mine...

And then...your vote #3 can be random or pointed...

Thanks for your time.

Saturday, June 13, 2009

sun's blueprints

Very nice. I just had another look at Duncan Mills' Autosuggest tutorial using Sun's blueprint project. I am really beginning to understand what they were doing. I downloaded a bunch more stuff to look at on the plane going back to Virginia. Very interesting.

This is the article I am talking about. I looked at it a year or so ago; I understand it much better today. The blueprint project has a bunch of very useful, interesting custom JSF component code to look at for free. What a learning opportunity.

So was able to implement this as is, but I had some trouble using the BindingContainer. But I used #{data..dataProvider} to get the application module instead of going through the bindings layer, and that got me to the same place. I have not isolated the exact trouble with the bindings layer yet.

I realize that the BindingContainer layer (JSR 227?) is very important, but I believe I am still abiding by the overall architechtural bent of using the Application Module as a repository for services, and accessing only the exposed ones. Right now I just have some vague notion that creating a PageDef and hooking it into the DataBindings.cpx file is somehow fraut with opportunities to make mistakes. I have made a variety of mistakes setting these up, but the binding layer issues have the trouble of not yet revealing to me how on earth to troubleshoot the problem. I only see that when I get the value for #{bindings} that it is null.

Ah well. On the lighter side, I was able to download the source for this textfield.jar that this example uses; and I was able to get the source working just fine. I also obtained the source to the other aspects of J2EE blueprints avaialble in the same download, and also an additional download which gives the updates for Java EE 5.0 :-)

That should keep me busy on those 3.5 hour plane-trips. ;-)

One thing I would like to improve upon for this component is that it does not respond to a down arrow or up-arrow. I think this should be doable.

Wednesday, June 3, 2009


Time sink...

I spent way too much time trying to get this to work. It is upsetting me, so it goes on the blog.

The general idea is I wanted to change an XML file from my Java program. My approach was to load it into a Document object, manipulate it. Then when I was done I would use a DOMSource and a Transformer to convert this Document to a String.

What was supposed to work that did NOT was giving DOMSource a non-document an element. I wanted a string for a particular element. DOMSource would give me an empty string when I gave it a viable element, but gave me exactly what I expected when I gave it a real document.

I have no doubt that there is some magic I did not adhere to that will get this to work; by God I am have a limited life span!! Someday I will be savvy enough to deal with this problem I guess...but for now I found it easier to convert the whole document to a string and use regex to extract the node I wanted. Man!!

Friday, May 29, 2009

Decorator/Wrapper pattern

I started writing code using Document class from

Pretty soon it seemed like I was writing a lot of methods which would logically go into an extension of the Document implementation.

So I tried extending XMLDocument (Oracle's implementation of this) in order to have a better place to put these methods.

But the way I was producing this document I was using DocumentBuilder method that parses a file, and returns a Document.

So in my code I could not think of a way to call this, parse method and get a XMLDocument and then cast it to my class so I could use my new methods.

SO: Here is what I did. I created a decorator (wrapper) class which implements the Document interface, and then passed in the returned document from the parse method to the constructor to my new class. Then all I had to do was to implement every method in the Document and Node interface (Document interface extends Node interface).

Only trouble here is there were a lot of methods in these interfaces, and other than write my own program to generate the default wrapper methods I had to hand-type them all in. Pretty tedious and generates a gob of code.

Vik Kumar from Oracle Corporation seemed to agree that this extra code was necessary to "extend" implementations of the Document interface.

Someone else mentioned on the internet that IntelliJ IDEA had a wizard to generate this decorator pattern class, but I downloaded a trial and could not find such a wizard.

Wednesday, May 27, 2009


OK. Been too long. Must do blog entry. Appologies in advance.

I like FindBugs. Check it out. Help you with your Java form and application robustness. Thanks to Olaf Heimberger for pointing me to it...someone else too from another part of the world also that seemed to have his head screwed on straight.

It lists and categorizes suspicious and crappy stuff in your code. You just can point it at the root of your application and say go. In no time you are going..."gee!" and "golly!"

Try it! You'll like it!

Thursday, April 30, 2009

exclusively programmatic use of PageDef iterators

Revision: if you have an iterator that you have included for usage programatically only, be very careful! I kept getting JBO-35007 errors when I did a post back!! So finally I removed the iterator and just got the app module programmatically, and did a findViewObject("viewObjectInstanceName") from it.

Friday, April 17, 2009

Where and how does ADF expand on or deviate from JSF?

ADF is different from JSF, that is for sure.

JSF is an open standard, whereas ADF open for its Trinidad components, but not its newest ones. For example ADF Faces UI components are custom JSF UI components. Generalizing about ADF Faces components, they usually have many more properties than the JSF components. For example, compare the af:table with the h:dataTable. There function is to be the same, but the af:table has many additional features that the h:dataTable does not have. For example the af:table has a selectionListener and sortListener built right into the component’s properties. The h:dataTable has no such property. It is still possible to have a radio button select a particular row in the table, but the way that is to be done is totally different. Selecting a row in a table can involve many things: selectionListener of the table, an tableBinding, the CollectionModel interface (for the value of the af:table), and the af:table’s selection facet. The h:dataTable does not have nearly so many hooks into this row selection functionality.
On the other hand there is a certain simplicity to the way JSF without ADF Faces works. For example, you may not need a SortListener, when you can write a backing bean method that does the sorting, and have your table column header link simply call the sucker.

Another difference between af:table and h:dataTable is that af:table can use the built-in Partial Page Rendering to simply refresh the table without refreshing the entire page. This refreshing can get a bit involved, but usually it is not if you remember one thing: the command item that instigates the partial page rendering of the table cannot be from within the table itself. So for example if there is a button within the action facet of a table that needs PPR-ing, then either the button needs to be moved out of the table, or it needs to use its onclick event property to press another (perhaps hidden) button which is outside of the table. But even with this odd caveat af:tables can do PPR relatively easily.

(PPR outside of tables seems to be pretty straight forward and helpful; some rudimentary AJAX at its best.)

Another add-on for af:table’s are how they work with the page def table binding and iterator definitions in order to easily page groups of rows forwards and backwards. The component that supports the h:table has hooks for this, but it must all be implemented relatively manually. This binding layer is part and parcel of JSR227 (Data binding). Part of this data binding layer also implements DataControl’s. I think this is very important for allowing the layers to be interchangeable, and hiding the implementation of the business service layer.

Another big addition that ADF brings to the table is the Page Definition file; this is also part of the data binding layer they implement. JSF components typically connect to backing beans for their values, whereas Oracle ADF likes to route value properties (and others) through the bindings in the page definition file for that page. Most times I think the addition of binding layer functionality is a boon.

At another level, Oracle ADF Faces Lifecycle augments the JSF Request Processing lifecycle; ADF lifecycle adds a prepareModel and a prepareRender and an extra validation phase to the various JSF phases.

Here is Oracle’s point of view of some of these differences:
The Java Server Faces components differ from the ADF Faces components in ways completely spelled out at the following URL:

The following list gives Oracle’s list of advantages of ADF Faces component set over straight JSF HTML and Core components (Oracle Corporation, 2006)
1) Provide more efficient implementations of client-side state saving (reduced per-component size)
2) Rich set of components, validators, and converters
3) ADF Faces tags often offer more features than the standard tags; for example, all input components offer built-in label and message display support ( For more information on the differences between the ADF Faces tags and the standard Faces tags, please see the following document ).
4) Client-side converters/validators - JavaScript enabled converters and validators that attempt to catch and display errors on the client
5) ADF Faces tags can be used inside of the <> tag (it is, unfortunately, not possible to support standard tags inside <> ).
6) Accessibility - support similar to ADF UIX Accessibility
7) Bidirectional language support - ADF Faces components automatically render themselves appropriately for bidirectional languages. Users can also use the "start" and "end" constants described in ADF UIX Bidirectional Language Support
8) Partial Page Rendering (PPR) - support similar to ADF UIX PPR overview
9) Skinning - support similar to ADF UIX Look and Feel
10) ADF integration - including support for JSR227 (Data binding)
11) Rich Client - upcoming rich DHTML client-side renderers

Open World Abstract...

I have submitted an abstract for Oracle Open World. I want to do an instructive paper on how to do custom component development. I think I still have a lot to learn; I had read a chapter or two and done some exercises and examples and thought I knew what I was doing. At the time I learned these basics I felt very proud of them. Now I feel sheepish for feeling proud, since I now know definitively some things which then I only kind of knew.

At the height of my smugness I decided I would try and extend a rich faces component…that did not work out quite as well as I had hoped. I was able to put markup before and after the af:table (rich table, that is), but I cannot seem (yet) to figure out how to get into the middle of it – inside the box where the columns are or in-between the columns. I thought I knew where to look for this, but I am not finding what I expected when I look where I thought I should.

So far my efforts to augment these components have met with very limited success. There is a section in the Fusion Developers ADF Guide 11g about extending components (I hope they mean UI components and not business components) that I should read for sure and probably reference. Maybe that will give me some insight. Maybe for my understanding level, it would be more helpful to attendees if I stick with more basic concepts, like how the pieces I know about interact.

I know the declarative components are custom component combinations, which is quite handy. I have a 10g project where I could really use something like that. Maybe that is something I can explore for my paper: implementing declarative component conceptually, in order to help understand custom component development.

For my edification however I would like to know more details on how Oracle implemented their rich components. When I try to alter them or get inside of them, everything I do seems to not allow me to get at the inner parts of the component. I do not know how Oracle is hiding this.
For starters I see that there are property elements in the components when they are defined in faces-config.xml. I did not know that component properties could be define or elaborated on there. I do not know what that adds, but I would like to know.

I should study JSF details from the Java EE 5.0 tutorial. Hopefully they would have some further explanation of this. Or maybe the standards for Java EE 5.0: maybe they specify some details of JSF that would help me understand what Oracle and everybody else is doing with their components…and help me with this paper.

ADF 10g interfacing with Pentaho

Pentaho is an open-source reporting tool that has a Discoverer-like metadata store for ad-hoc querying; I am alternately battling with that getting my ADF interface to it implemented.

Yesterday I went down a path I had probably been down before but forgotten.

I used a tree binding on a table to have a table in the details facet of an af:table. This worked reasonably well until I tried to update the child table data. At that point all kinds of strange things started to happen. The rows would get mixed up as to who their parent was, I think there might have been some any rate I backed out of that and went another route because that one was proving somewhat unstable.

Things are starting to get green here in Virginia!

Thursday, March 26, 2009

JSF Portlet Bridge and WebCenter

I did a post a while back on JSF Portlet Bridge that I will now revise, because things are not quite like I thought they were.

Let's say that your organization has an Oracle Portal 10g install. Then let's say you want to start integrating ADF Faces apps that were generated from JDev 10g. (That would be Apache Trinidad in JDev 11g parlance). Here is what you would want to do: install your ADF apps on a Oracle App Server. Let's say you did not have the WebCenter license of any kind. Then you would need to add some kind of generic web page with an iframe on it that called out to the ADF Page. That would be your option.

But let's say you had the minimal, or "Services" WebCenter License (I believe that is priced by CPU-core count.). Then you can deploy your ADF Faces apps to that same after you have doctored it up. By doctored it up I mean the following:
1. Install SOA
2. Apply patchset
3. Create new oc4j in EM. Call it wsrp2
4. Install portlet-server-install.jar
5. PER NOTE: Note 752220.1 Java.Lang.Noclassdeffounderror: Javax/Xml/Soap/Soapelement Deploying Standalone Application
cd $ORACLE_HOME/j2ee/wsrp2/config
vi server.xml

6. Start container. (opmnctl startproc process-type=wsrp2)
7. Deploy application. NO ERROR

A few notes about this process above:
  • You can get the portlet-server-install.jar by looking at the following:


Oracle Portlet Container and PDK-Java

  • Your Oracle Portal installation will need to be up to date. So that means at least your Portal Repository needs to be at then you will have a work-around because your images will not work right. It is best if you upgrade to on your iAS and on your Portal Repository and do all the pertinent patches...and there are a few! But they are documented.
  • At this point there will still be some CSS-related issues that are documented in an Oracle bug. (7968131) I am gathering this case is not being worked too hard, though.

So then you can consume your "produced", portletized ADF apps just fine. They work pretty darn well, too!

Apparently, though, JSF Portlet Bridge is not supported by Oracle for Apps that you deploy to the OC4J 10.1.2.x -- which is Portal 10g's current iAS platform until Portal 11g comes out.

web.xml role-name with spaces

I was having some trouble using with a value with spaces in it. I figured out why and how to fix it: The XML parser probably fails to read the role-name data because role-name is defined as xsd:ID in XML Schema which cannot have spaces. So if you escape the role name with CDATA, which suspends parsing, your roles will match up with LDAP roles that have spaces in them -- if you happen to have that convention in your LDAP. So now role-name entries in web.xml look like the following if they have spaces in them:

<role-name><![CDATA[my role name]]></role-name>
instead of

<role-name>my role name</role-name>

Wednesday, March 25, 2009

Quick Note about JSF, ADF and Postbacks

Unlike ADF, in pure JSF it appears there is no AdfFacesContext.postback context element to use to determine if you are currently in a post back or not. To determine postback you have to do some odd stuff.

So what is a postback? In short it is when a JSF page submits and it stays right where it is. In other words the action of the form is set to post to itself, passing all of its named fields as parameters. When the Faces Servlet sees this occurring it alters its “behavior”. The normal JSF request lifecycle has 7 or 8 phases when it is drawn out for others to see…but all these phases only come into play on a post back. When you first call a JSF page, all that you actually get is the first and the last phase…everything else is left out.

These postbacks are extremely important in the Rich Component world though. You have to postback in order to implement a very nice way to do AJAX functionality without having to make others who want to use your components add servlets to their web.xml.

Programmer Metamorphosis Psychology 101

It is always interesting to read journal entries. I found one here that someone might find helpful. Fortunately it has a happy ending... :-)
I am undergoing a change of a drastic nature. I am going from being a Forms/Reports guy to being a Java guy. I have been elated during most of the professional “metamorphosis” time – especially where I did things I was afraid to do at first, but then I realized I could handle it. I was productive and HAPPY about having done these things…about having suspended my disbelief long enough to know that I was about to say I could do something, that I had no idea I how I would do…long enough to put on a happy face to the person that wanted someone who appeared confident to tell them we would make miracles happen. And after a fashion I would even see how I was going to get these things done. But I never would have tried if I had not suspended the disbelief long enough to say: ‘I can do this’ to someone without having the slightest idea of how I was going to make that happen.

And…when all was said and done…I was better for this “lie”, and so was my employer. I was always taught not to lie.

In the Constitution of System Engineering Services Corporation®, there is a phrase in there: that they expect their employees to Stretch. That is what I am talking about.

When I was doing the work and working miracles, I was happy, and excited…LIKE I HAVE WANTED TO BE IN MY PROFESSION ALL ALONG. I thought the right thing to do was to be faithful to your technology, and your boss and their wishes. But…what if your bosses are fearful? What if they don’t know this secret about stretching? What if they know it but don’t want to do it because it’s scary? Then they suffer. Their company suffers. Their employees suffer…at least those that buy into this mode of behavior.

Why should anybody GRIND IT OUT with embarrassingly outdated technology at their job which is providing a paycheck, but which is providing a place where they are losing ground? Why?? Everybody is failing then…employer and employee…

All you need is to find a risk taker…and to be a risk taker. And I think you have to renew your vows to be such a risk taking creature on a daily basis. But the result is you have fun, learn lots, become more marketable, make friends, um…is there a downside to this?

I am still learning gobs…I hope that never stops. I guess I have something to do with it stopping or not, eh?

I hope you can benefit from the following analysis, and hope it aides you in whatever metamorphosis you are currently undergoing.

12/15/08 – Slight addendum to this forward: I am currently looking for work. So this transition is causing me some pain now. I feel it is because there are not jobs running out of everybody’s ears now that the economy is messed up. It is also because it is late in the year and that is a notoriously bad time to be out of work. But there is another thing the fledgling risk-takers should be aware of. You should strive to find good positions where you will continue to learn, but most employers want you to already be experts in whatever their suite of technologies is…and you also have to be better at this particular suite than 90% of the other candidates who are applying for that position.

Obviously, this is a difficult situation. Yes it is. I do not regret trying to leave Forms/Reports behind. I am a little worried I have not been more responsible…on a bad day, but mostly this is just the trough of the biorhythm of learning a new bunch of technology. Because…as I recall: finding a new job is ALWAYS a little…OK: a LOT…scary! When I get my job I will be elated…not bored and internally dead and miserable.

1/8/09 – I may have found a place in Minnesota (Trane Corporation) that does custom JSF component development, and really likes my work. So: off I go (happily) to St. Paul for the next 6 months to a year.

1/20/09 – Trane just announced a hiring freeze. Darn. Back to more looking.

Tuesday, March 24, 2009 -- OK: I am now at Fairfax, VA. Things are going well and we are speeding our way toward our first ADF app for this company. It would be ideal (in my boss’s words) if we could do work in WebLogic with the new ADF 11g technology. Wouldn’t that be sweet…??? Back on top of the world.

Wednesday, March 18, 2009

Developer Day Notes

I have some notes I would like to share about Oracle Developer Day. I got a whole lot out of it. Most of it extremely positive.

Here are my notes from the session. Hope they are helpful.
OTN Developer Day Notes

· OPI? OPEE?? (Eclipse Oracle Developer pack)

· Panel Collection – can surround a table to et a header and footer

· Rebuild will allow you to sometimes avoid rerunning a page in IDE

· Export to Excel – component to do that (uses a listener of some sort)

· FMW 11g released – calendar year 2009

· Moving splitters – maintained per user by session. To persist user settings you can use Oracle MDS – for example for a set of users you could create a preference set and store it on a database.

· When I deployed to 11g, I did not see OC4J as an option. But Lynn Munsinger says it is among the app servers they offer.

· The focus of the binding layer (JSR 227) is to abstract business services so that you don’t have to know implementation specific details SOAP,WSRP. Also it reduced the number of backing beans you need to write, and also shortens the

· I need to build a wiki of some sort (there is support for this in WebCenter suite).

· Components are ADA (Americans with disapbilities act) compliant

· Learn more about MDS (Metadata Services).

· Although ADF/BC control hints is UI mixed in Model (violation of mvc), it allows us to set standards.

· Can package up ADF BC’s as a library and deploy it, so developers can use this.

· Static list – keep small.

· You need to get a handle on deploying Application Modules for use by company.

· Google “ADF Methodology” – google group has a grassroots naming standards.

· Can create resource bundle on the fly when you create control hints.

· How do you create a plsql web service? Then you can use them in ADF/BC.

· JSF Component good because for example, table takes a collection and is trusted with doing the right thing with the data to make the table viable in HTML.

· What is stateless again? Lynne kept talking about stateless components.

· Check out print component, poll, listeners (that’s that client/javascript thing, I think)…

· Graphs are svg or flash.

· ADF Data Visualization are the graphs I think.

· Experiment with reusing a task flow.

· Task flows can go into a region really easily.

· Bounded task flows can battle the back button (huge reason for using task flows).

· Task flows are integrated with database transactions and process trains

· Can bundle components (like address block) as declarative components.

· It is better to add javascript to a component by creating a custom component and adding javascript.

· Decorative box is a nice layout; three column template is the fusion look.

· Awesome demo; my bosses really should have been there for it. Lynn Munsinger was doing it.

· If using non-adf business components (EJB, or session bean…), you can create declarative validation on the adf binding layer….not used to much often.

· Read the fusion developer guide.

· Read the Fusion UI Developer’s Guide

· (there will be a SOA Developers Guide)

· Q&A on OTn

· JDeveloper might be “less free” if we do not deploy to WebLogic server.

· While we are waiting for FMW 11g to come on line, I need to be establishing standards, best practices, packaging task flows and app modules for reuse, creating templates, creating declarative combined components, skins, page fragments, backing bean bases, ADF/BC component bases, ….

· Active Data Services – pushes changes to data. (ADS) better than polling.

· If we deploy to Tomcat 6.0 we have to pay for license to use the ADF libraries.

· For some reasons, when I was trying to add a default value to an entity date attribute, the groovy expression that I typed in did not register as having “taken”. I typed the value in and hit enter…well actually the first thing I did was enter the expression editor, which opens a dialog. But as soon as I went away from that context and came back the value I had entered did not appear. I bet if I had just entered the default value groovy expression on the property, the value would have taken as expected. At any rate entering the value in the field and switching to the source for the page made the little green dot appear in the property sheet, but no corresponding XML attribute value appeared for the “attribute” element for hireDate attribute. So finally I quit out of JDeveloper and reentered the tool. Then I entered the groovy expression, pressed enter, and it took: got the green dot (signifying non-default value in this property), and I checked the source screen and saw the corresponding DefaultValue attribute pop up with the Groovy value in it. Yay! Oddly enough once I got this to take I had accidentally left the value type to literal…which caused an error…because “adf.currentDate” is not really a valid date, is it? But changing to expression type made the XML change to a Transient expression and the data was put in a “CDATA” thingy. Lol Then it worked.

· Do the demo on page 23, 25, 27, etc. of the class pdf for your bosses.

· I wonder if the Fusion Developer’s guide has good documentation on the aspects of the groovy language that you need to know in order to, for example, express the endpoint values of a validation rule’s range as parameters that could be incorporated into an error message.

· For column selection I am not sure what freeze, wrap do. Not sure what the point is of detatch, but maybe I would discover all this stuff down the road. The tutorial called attention to the features, but I do not see what to do with them yet; and the tutorial did not say either.

· When you do a new ViewObject on the model, and you are to select the entities you want to use, the first one you select is marked as updatable, and reference checkbox is grayed out. When you shuttle over the second entity it assumes it is a reference. Of course this maybe due that not only is employee a child of department, but department is a child of employee due to the manager FK.

· Lynn said to post test cases of bugs on JDeveloper Forums

· Need to download a slightly newer version of JDev 11g which has fixes to memory leaks and many other issues…the memory leak issue actually makes the permgen error happen, and when you try to correct for it by restarting the embedded web logic server the same error happens. If you just restart JDeveloper, the WL Server won’t start because it says there is already one running. The fix for this is either remove the java.exe process in task manager and probably restart JDeveloper…or download this new version of JDeveloper that has a patch for this and other problems.

· Page Flow versus Task Flow – which one if either is related to an open source standard? Is Page Flow simply JSF’s built in controller, or is it something else?

· Is there a version of OC4J which works with Java EE 5.0. Yes! OC4J 10.1.4 (did not know that existed.) It does not quite do JPA 3.0 right because it was produced prior to the spec being completed for Java EE…but everything else is fine. When I asked Lynn if ADF Faces Rich Client could be deployed to this, she said “no, because of differences in libraries”.

· Could developers use either JDev 10.1.3 ADF Faces, or JDev 11g Trinidad for the same app depending on their preference?

· Client/Server: what does it buy you to run the components on the client side? Server side?

· Custom login modules? Are these harder to write in WebLogic? The same? Are there more built in options.

· Can you pass parameters in via EL? Used to be only HashMaps would allow this. Other means now? (In Java EE unified EL)

· What kind of expressions are allowed in the Token Message Expression area of the validation for an entity? For example, on a range how would you access the ends of the range? Is it Groovy? Where is the list of valid Groovy expressions?

Friday, March 13, 2009

doing battle with WSRP, Part II

Had a great session with Oracle technical support over the trouble I have been having with portletizing ADF Faces. The analyst mapped out an upgrade path for me which will solve all my problems; he demonstrated on his upgraded scenario using ias (instead of my, and using Portal repository, plus the mandatory updates (instead of my, and also if I am going to deploy to OAS, that I make sure I have applied the web center jar file that WSRP-enables your particular OC4J instance that you have designated for exposing ADF apps via WSRP.

If I do all this, he demonstrated that the same ear I was having problems with, worked like a champ! YAY.

(The SR is 7381737.994 if you need it for reference. If you cannot access it, please leave a comment for this blog entry, and I will see if our situations are similar enough to warrent further action.)

Thursday, March 12, 2009

What forum is best for answering Oracle Portal-JSF integration questions?

WebCenter Framework Oracle Technet forum

The above URL is the WebCenter Framework forum on the Technet forums. This is the place that Peter Moskovits and similar people review and comment, and the place where questions get answered of the kind I have been dealing with lately.

I read the overview of WebCenter and I guess I did not realize that portal-JSF integration was synonymous with "WebCenter", but I think it is for some reason...

I hope it helps you.

JDev 11g's Class Diagrammer

Must comment on JDev 11g's Class Diagrammer.

I wanted to diagram some classes. I was in the Model projects of a MVC project, and the project technologies, under New gallery, under Diagrammers, was Java Class Diagrammer. So I selected it. Then I discovered that it seems this diagrammer is geared toward ADF/BC Java Class other words, if you want to model an entity or a view Java Class or something. I guess my poor brain has not even conceived of the need for such a diagrammer, but there must be a methodology where such a thing is a good idea. I will have to experiment with that...

But for that timeframe I just wanted a simple UML Class Diagrammer, but to find it you need to select all technologies, and select Class Diagrammer...not Java Class Diagrammer. What-EVER!! Now I am in the KNOW.

Once in the Class Diagrammer things went very smoothly. You can enter attributes and method with a short hand where + means public, - means private, # means protected, and blank means package. The diagrammer makes it pretty simple to enter multiple attributes at a time: type one, hit enter...and the diagrammer is waiting to take the next attributes. Same with methods. Links are pretty intuitive as well...which for a diagrammer is good.

That's it. OKThanksBye.

Tuesday, March 10, 2009

doing battle with WSRP

Victory! I got a portletized ADF app to deploy to JDeveloper's preconfigured oc4j. Here is how I did it and some pitfalls you can avoid: technet's jdev forum thread

I need to add more to this post to document what I did and did not try (for many reasons). I did a basic ADFBC/JSF master-detail app. I just dragged a child collection from the Data Control pallet into a Panel page and dropped it as master detail. I also put a menu tab on top that went no-where. (If this seems a familiar demo, it is the same one used by Shay Shmeltzer in a recent blog about Trinidad.)

So, I used the WebCenter Developer Guide to instruct me on portletizing my simple app. No problem there, I don't think.

Then I made a deployment profile (WAR) for the ViewController project. Then I deployed to an ear from that profile. That's where it starts to get interesting. During this deployment process, a dialog window comes up asking if your target Portal Container is or above. Now maybe this number is a WebCenter version of some sort...not sure. Our Portal version is 10.1.4. It is on a OAS installation. So I tried answering both yes and no alternately to this question. Both created an ear, but the deployment results are what varied.

No seemed to create a JSR 168 producer, but I am not sure how to tell Oracle Portal to find this consumer. It seemed all the documentation I found has WSRP associated with JSR 168.

When I tried to deploy the ear to various OC4J's the results were varied:
  1. The "No" version of the ear file deployed everywhere, but I did not know how to consume it.
  2. The "Yes" version failed to deploy on the Oracle Portal OC4J, 10.1.4, because the process of creating the "yes" ear file installed an orion-application.xml file, which had an element that the OAS deployment process could not handle...something like or something like that. I had trouble finding documentation on this element, but I am guessing that J2EE 1.3 had no such element in its DTD for orion-application. I did try creating my own version of orion-application.xml with a version 2 orion-application.xml, instead of version 10 -- like the JDeveloper ear generator produced. Still OAS did not like this...the element was still foreign to it. Also the ear generator renamed my orion-application.xml file and put is own back in there, so I would have had to edit the ear file to get it to accept mine, during the ear generator's "yes" path. But even on the "no" path, when I put a version 2 orion-application.xml in my META-INF directory, with the same "mystery" element, the OAS deployer still could not deal with that element.
  3. The The "Yes" version of the ear failed to deploy on a OC4J (stand-alone) version due to a Null Pointer exception I think.
  4. The "yes" version succeeded when I deployed it to the pre-configured OC4J which is installed in the /jdev/extensions directory. Although as noted on the technet link above, I had to log in twice to get into EM. The first time gave a JAXB error. Also once in I did not have button images, so I had to go from memory.

So anyway...I am now asking our OAS to find and consume this baby, now that it is WSRP-produced. development computer is apparently on a different sub-net or something. So today I am going to change my development computer to be fixed IP, and try this stunt again. Wish me luck.

Wednesday, March 4, 2009

ADF/Portal interview with Peter Moskovits

The company I am with and I interviewed Peter Moskovits, and got some questions answered we had about migration path of Oracle Portal 10g users and how to integrate the changing versions of ADF, which version of WSRP to use in which case, etc. Here are part of the minutes to the meeting:

Peter started with an overview of the Oracle products and product direction. Peter noted that Portal technology is a decade older than ADF technology, so efforts to merge them are challenging. Peter mentioned that there are a couple of kinds of portlets at work here: PDK Java Portlets, and WSRP/JSR168 Portlets. The latter is where the future is. In each case each technology offers something the other does not have, so Oracle promotes both. With Portal you have features such as runtime customization, reusable portlets, and content integration. So you can include portlets into ADF using WebCenter technology, or you can bring ADF portlets over and consume them WSRP 1.0 or 2.0 using JSF Portlet Bridge technology.

Regarding Portlet Bridge licensing…Peter says that there are two kinds of licensing for WebCenter: a WebCenter services license (meant mostly for developers) and a suite license (to get everything). The services license would be cheaper also than the suite license. If the Portlet Bridge was the only part of WebCenter that you were using, it sounded like you should get WebCenter Services license which is cheaper. The Portlet Bridge enables communication with OAS/OC4J to obtain exposed portlets through WSRP portlet producer. If we are using 10g portal (OAS 10.1.4), we would need to use WSRP 1.0 (I have a question out to Peter to know if we could use ADF Faces (10g) PPR features with WSRP 1.0 or not).

Peter acknowledged that if you had to use OAS 10.1.4 that you would be much better off if you deployed your portletized 10g ADF Faces apps to OAS, and then consumed them with the server with WSRP 1.0; rather than deploying directly to OAS and having to dumb your 10g ADF Faces app down from 10.1.3.x down to 10.1.2 technology (J2EE 1.3/JDK 1.4 from J2EE 1.4/JDK 1.5).

We should not deploy portlets with the SOAP provider if we are using ADF; we should use the JSF Portlet Bridge. SOAP was only for Struts applications.

Peter and Jay both let me know that deploying a 10g ADF program was no big deal: a 3-step process, that was well documented in the 10g WebCenter Developer’s Guide.

Tuesday, March 3, 2009

JSF Portlet Bridge for dummys

Today I read an entry from the blog of Oracle Portal Principal Product Manager Peter Moskovits, dated from about 9 months ago. It talked about JSF Portlet Bridge, and showed him creating a video of his creating a an application which demonstrated JSF Portlet Bridge at work.

I am just starting to learn about Oracle Portal, unlike Peter, so I thought the world of people who are at my understanding level might like to hear my comments. All of the following are eithe quotes from Peter Moskovits, or they are my interpretations of Peter's words or actions, coupled with what I know and have read.

So in JDev 11g you can right-click on a reusable item called a Task Flow, or a jspx/jsp page and something comes up which says "Create Portlet Entry...". Doing this action will create a file called portlet.xml which is apparently the key file in portlet applications. I believe this is the equivalent of doing what is called "portletizing" an application.

In Peter's video, he is deploying his portletized JSF application to the embedded preconfigured OC4J which also had the portlet container in it. Even after this app was portletized, Peter could still run the jspx/jsp files individually. But also Peter demonstrated that you could access something called a "portlet producer". Apparently there is something called WSRP which is a portlet producer. I guess WSRP is a web service also because it has a WSDL, which you need to copy and save if you are ever going to use the portlet-ized JSF app you made.,..and also deployed.

WSDL URL's are also called "endpoint URL's".

Although it appears you get to the portletized JSF applications though the WSRP service, portlet parlance says that your application "consumes" a portlet...just like an app consumes a web service.

So when you create your application that consumes portlets (preferable, hopes oracle, a webcenter template application out of JDev 11g) it is called a portlet consumer application. In JDev 11g (and probably all IDE's) you need to register the portlet producer with your application. In 11g Jdev this is done by...
  1. clicking ViewController project
  2. New --> WebTier --> Portlets --> WSRP Producer Registration
  3. Name the portlet producer you are registering
  4. paste in that WSRP WSDL you have been saving (see above)
After a successful registration you see a WSRP producer node in the Application Resources section. This opens up to child nodes and you see your portletized JSF app.

Then in your app you can just create you JSF (or other technology that supports using WSRP), and drag and drop the portlet out from under the WSRP producer node and onto the page. This will add the portlet tag and portlet binding to the page (assuming you are using ADF, ;-). If you run it you will see your page in a portlet on the browser.

So where is the JSF Portlet Bridge coming into play here? I read that the JSF Portlet Bridge bridges JSF and Portlet technologies...but where do the implementing classes reside. I think they reside on the machine where you first deployed your portletized JSF application. I am beginning to think that this app server that you first deploy your portletized JSF app does not need to have a Portlet Oracle Portal. I think it just needs that portlet.xml in order for WSRP to talk to it. I suspect that WSRP needs to be implemented on both ends...probably the same version...but maybe not?

I know this though, because Peter said it: when you create your portlet consumer application, you can use your published portletized JSF app in any other 3rd party portal that supports WSRP (and the version of WSRP you are using).

Still trying to digest all of this. Tomorrow I have a conference call with Peter and the rest of my teammates.

Here is the video Peter made... video

Also the link for the JSR for JSF Portlet Bridge has a Spec with some great overview material in it. It helped me.

Friday, February 27, 2009

MyFaces Orchestra conversation-scope

I have experienced some issues with ADF Faces (out of JDev 10.1.3) which (I was told) were probably related to inadequate garbage collection (probably on session-scoped managed beans and variables). So I have been looking for something that would help this application's robustness.

I saw a product which may help with some of this. It is called MyFaces Orchestra, and it might be worth looking into. It would allow custom bean scopes called conversation-scope. This framework uses Spring. If there is a problem with accumulating garbage, this would surely help keep such things under control. Apparently improving things like this could be an iterative process; conversations are by default of session duration. But later you can group beans and garbage collect whenever you decide the need arises. But even the act of putting all session-scoped beans into this framework might be a great first step to helping this situation.

Wednesday, February 25, 2009

Deploy ADF Rich Faces Client app to OAS 10.1.2

My team lead asked me to investigate the idea of moving ADF Rich Faces applications (deploy, that is) into OAS 10.1.2...or at least 10.1.3.

Shay Shmeltzer said the following:

ADF Faces Rich Client require JSF 1.2 (part of Java EE 5).
OAS 10.1.2 came with a Java EE 1.3 server - you can install an OC4J 10.1.3 on it and that will bring you to Java EE 1.4 - but you still won't get the needed JSF 1.2 support.

On top of it the ADF 11g libraries were compiled with JDK 1.6 - OAS 10.1.2 uses JDK 1.4 (or maybe even older version).
Let us assume that ADF Rich Faces components uses new features of JDK 1.5 at least, even though it is compiled with JDK 1.6 (this may not be a valid assumption...if they use features that are only in 1.6...which is possible I guess). Is JSF 1.2 certified with J2EE 4 or 3? Let's assume not. So we would either have to find some weird JSF implementation that tries to implement JSF 1.2 features, while being compatible with JDK 1.4. That might be possible, but would it be profitable or interesting for anybody to do such a thing? I do not know.

What about somehow installing what is necessary into a J2EE 1.3 server to be able to process Java EE 5.0 stuff? I think it would be easier to simply use a different container...

But what if it is not. Would it be less work to extend a web server so that its core includes multiple j2ee version capabilities...than it would be to simply install a new webserver and reference that? What about manhour costs?

But what if I developed my own brand of rich faces that looked and smelled pretty much like Oracle ADF Rich Faces, but worked with OAS 10.1.2, or 10. 1.3? The end users would not have to break down and pay for licensing from Oracle (which, by the way, may be covered under their license anyway since there is some transferrance of licensing from OAS 10g to Oracle Fusion Middleware 11g...but they have not got around to checking yet...)

Given what I know this last option seems the best. Even though it would take eons for me, alone, to get the full suite of Oracle Rich Faces look-alike components implemented and debugged. But it would be fun to try...

Tuesday, February 17, 2009

Migrating ADF app from JDev 10.1.3.x to JDev 11g

I guess I had not thought this all the way through before. Now that I have, perhaps others can benefit.

Let's say you have an ADF application and you want to migrate the application to JDeveloper 11g.

From reading the forum I gather it matters (perhaps it does not any mattered in October 2008)

First, know that today I created an application in ADF in using ADF/BC and JSF. I used order and order_items tables to create the simplest possible default, read-only drag and drop page. Then I copied that Application folder over the analogous mywork folder on the JDev 11g side, pasted it in, and opened it in JDev A migration wizard opens up and tells me that not only is it converting my J2EE technologies to Java EE 5.0 (i.e., JSTL 1.0/1.1 to 1.2, and JSF 1.1 to 1.2), but also is migrating me to the Apache Trinidad JSF libraries automatically. (Also the migration wizard told me it is migrating me to Webapp 2.5...not sure what that entails...I thought it was the same as going from J2EE to Java EE 5.0...but maybe not). So when I click Finish, the migration successfully migrated this simple app. I then ran my one view/screen in this app.

Failure. Damn...but the failure exception trace showed a problem finding the class UIXPanelTag. So I searched for UIXPanel in all the files in my converted Application using the Search Files menu command. The only references it found were in a jar file located in WEB-INF/lib. So I looked in my project properties... Basically I had gotten accustomed to including ADF Libraries, ADF Portlet library, and Custom Components library in my JDev instance. So when I created this quick little ADF app, those files got included as well...which makes sense for the ADF libraries, but the wizard did not know what to do with the portlet or the custom component libraries, so it just made like they existed...unfortunately...apparently they do least not by the same name... So a compile error happened when I tried to build/run the application.

So my solution was to open the view project properties, remove the portlet and cust comp tag libraries, then also removed the place holder entries for all the libraries JDev 11 could not find, but were referenced since this was a converted app.

Then the app ran fine!!! Whee!

Also (for more complex good ol' SRDemo application) basic migration process is explained here (thanks again to Shay Shmeltzer for calling to Steve Muench article!!!!!):

Thanks also to Shay for also noting that, "if your migration process get stuck - try invoking JDeveloper using the jdev.exe and look for any specific exception in the console window."

Oracle Portal? Oracle WebCenter? Oracle WebLogic Portal? huh?

I have reviewed these documents. I have some thoughts about them...

Oracle Portal, Oracle WebLogic Portal, and Oracle WebCenter Suite are all sepparate offerings/product suites. Portal products are extensions of their respective app servers (OAS, and Oracle WebLogic), which are geared toward developing portals -- sites and pages which display and allow interaction with other sites and pages -- portlets.

WebCenter Suite includes the following items:
WebCenter Framework -- a JDev extension to help you do more Web 2.0, BI, and SOA stuff.
WebCenter Services -- I am guessing these are either the enabling libraries the the above JDev extension, or maybe they are sepparate program, or perhaps even web services.
WebCenter Interaction -- a development team collaboration suite (formerly BEA Aqualogic User Interaction)
WebCenter Anywhere -- wireless services (hardware? local or remote/hosted?) that let you get alerted to events generated by your webcenter apps, or interact with them, using various portable devices (blackberries, etc.)

I am also reading another document to round out my understanding of web center:

So we ask the questions: What about all of our Portal work? Is it integratable? Are they planning on merging/phasing out/replacing Portal?

After reading the WebLogic Portal and Oracle Portal statements of direction above, I am under the impression that Oracle is doing what Oracle does best: obtaining/promoting competing products, and letting them fight to the death. It looks to me that the Oracle Portal longevity is being promoted a bit more than the Oracle WebLogic Portal product (suite)...but the documents seem to like both products and highlight aspects of both that are being highly praised and integrated, and also other parts that are being sifted out. I think both documents point to a future time when the portal products will be part of a larger product suite...perhaps WebCenter.

After reading these, I come away feeling assured that there is probably going to be continuing support for these products, and that any integration or communication between the portal world and the WebCenter/ADF/application world is going to be supported -- we will probably have to end up choosing which integration method makes the most sense.

Also I feel that Oracle sees Web 2.0 as an evolution of Portal-type thinking. Vedy interestink...hmmmm....

Monday, February 16, 2009

put 11g ADF app on 10.1.2?

I was asked if we could possibly put an 11g ADF app (rich faces) on an AS 10.1.2 server instance. My instant response was, no...but I needed well defined reasons and my knowledge was failing me. So after a question to Technet here is what Shay Shmeltzer said to me on this subject:

Here is the thread:

Here was his answer in the thread above:

It's very simple: ADF Faces Rich Client require JSF 1.2 (part of Java EE 5).OAS 10.1.2 came with a Java EE 1.3 server - you can install an OC4J 10.1.3 on it and that will bring you to Java EE 1.4 - but you still won't get the needed JSF 1.2 support.On top of it the ADF 11g libraries were compiled with JDK 1.6 - OAS 10.1.2 uses JDK 1.4 (or maybe even older version).

So: here is my take what he said was this:

  1. I have studied the differences between JSF 1.1 and JSF 1.2. These two technologies are implemented by different “implementations” or different sets of Java Libraries. I believe the new libraries are compiled with JDK 1.5 or 1.6. Whereas 1.1 is compile with pre-1.5 JDK versions.
  2. JSF 1.2 components use some Java EE XML formats for the implementations of their components/tags.
  3. The JSF Java libraries main differences are the substitution of “expressions” for “binding” which simplifies and clarifies the purpose of the use of these items in many ways, especially when building custom components. For example a property which is designated as being able to accept a method expression can also take a literal as well as an EL method designation, just by virtue of being an expression. The older method binding would require additional work to deal with a property being able to take a literal or an EL expression. (Please, note that not only are there other differences between 1.2 and 1.1 that I do not yet know about because I am still learning things about JSF 1.2.)
  4. JSF 1.2 is expected to be used with JSP 2.1, JSTL 1.2 and Java EE 5.0, which are usually a factor of which app server/servlet container you are using (i.e., OC4J version, or whatever servlet container you are wanting to use). Whereas JSF 1.1 is designed to use JSP 2.0, JSTL 1.1 and J2EE 1.4.

Note: there are new features in JSF 1.2 that did not exist in 1.1.

Thursday, February 12, 2009

11g rich table

More thoughts about JDev 11g rich table. It is very important if you are having trouble controlling the width of the table that you check the width property. The wysiwyg editor for Jdeveloper for this component will allow resizing on the screen by clicking and dragging. But once you do, it codes a width in there which disables default sizing behavior, and was causing me some major head-scratching.

Also, it does not appear that you can turn off the table component's outline. We shall see.

Also, it appears when adjusting column widths in such a table, that it is best to stay away from using the wysiwyg editor to drag things around. It seems the result of resizing columns is unpreditable to me at this point in my learning; what I mean is this: I tried to resize one column and all columns resize. I can kind of control column resizing, however, by manually changing the columns' width property...because those I can multi-select and change all their properties at once to something smaller (or larger).

Also (a lot of also's) I wanted to avoid the horizontal scrollbar for the table component. But if you use any of the column stretching capabilities it seems to enact the horizontal scrollbar, even the size of the inner content only exceeds the width of the div by a few pixels. I think I could control this if I used some javascript to somehow identify this div's id, the used overflow-x css command somehow. But I cannot control this on the skin level.

In many cases, of course, things render much better in these regards in firefox than in IE...

Wednesday, February 11, 2009

JDev 11g Rich Components

My favorite rich component is the RichMenuBar component because it sounds like you could EAT IT!! :-)

Nevertheless, I am having fun exploring all the new and interesting developments in JDev 11g ADF Faces...the rich sequel. Here are some things I have noticed:
  1. af:tables might handle paging through records it a scroll now??? I do not readily see an option to designate how many rows go on a page...of course maybe that was never an option.
  2. Adjusting af:table columns in the ide is possible but tricky. But you can tell it to create a blank column at the end to take up any remaining white space.
  3. af:breadCrumbs are new. Very nice.
  4. If you do custom skinning you will be delighted to know that you can now EXTEND blaf or any other skin family!! No longer do you have to invent your own. This is really great!!
  5. af:menuBar can contain af:menu or a command item. And menus can contain menus or command items....that means you can now do real menus...that look really, um, menu-like!! yay! out of the stone age and into the light...
  6. one of my favorite things here is their tool which is an application which allows demoing of each component with respect to functionality, usage and skinning experimentation. I mentioned this a subject or two ago.
  7. There are other things, but it is getting late and I am tired. I will try to elaborate more tomorrow.

Friday, February 6, 2009

JDev 11g Cue Card impressions

To begin to get a feel for how things have changed between JDev 10g and 11g, I decided to follow the cue cards to create a new Fusion Application and also the cue cards for the ADF Faces features.

For the Fusion App here are my impressions:
  1. The same basic features are still there, only with a new look and feel.
  2. I think there were only a couple of mis-matches between what I experienced and what was expected by the cue-cards. They were that in one case an OrderId1 field on the editOrder screen needed a numeric converter added, and in another case there was a default value that needed to be added (0) for a field/column in the orders entity (order version id or something like that).
  3. The page flow diagram has been enhanced. Running an app now needs to be done with respect to this page flow diagram.
  4. There are several more WEB-INF xml files that are created as part of the development process.
  5. View Accessors are used a lot to do LOV/Menu/Drop-down list functionality. These are connected at the entity level also. I am pretty sure such work would have had to have been done programmatically if at all in JDev 10g ADF.
  6. View Criteria functionality also would have been done programmatically in 10g; now much is declarative...i.e., done through wizards and dialogs. View Criteria seem to be intimately connected to Search sections of a form. In 10g there were several ways to make these search forms happen. With the help of the ADF Developer Guide these different methods were not so bad, but there with View Criteria, now you can drag and drop such a Search Form region onto your page. Also you apparently do not have to redefine a new query for each search form you want to create...just a new search criteria. Also I notice there is a new ADF Faces component called af:query.

I will post some more thoughts as I finish up these cue cards. I think these will be a great warm up to actually working with 11g on a daily basis.

Wednesday, February 4, 2009

Very cool demo app!

News flash: there is a really cool app that Oracle put out to showcase their new components and features and skins with ADF Faces Rich Client suite. I thought you had to install it to look at it. But Moskovits's blog says it's online also at the following link!!

My goodness: if you don't study this site you are really missing out. What a lot of work those Oracle guys and gals have done!!!!!

This demo app shows all the rich client components and what they do. You can also view the usage of each of them. Incredible.

Also if you want to download this app to study it you can do that as well...
Just click on

In there is a war file you can download. Take that war file and import it into a Generic application as a project. In the new project dialog there is an option to create a new project from a war file.

Thursday, January 29, 2009

h:inputTextarea rows attribute does not work?

For the sun JSF 1.2 Sun implementation, has anybody noticed before that h:inputTextarea's rows attribute has no affect on the height of the textarea?

JSF 1.2 MyFaces implementation does fine though... very odd. I tried googling this issue and did not find it readily advertised. Maybe now it will be because of this blog entry.

Saturday, January 17, 2009

extra field!!!

I was doing a custom component in JSF, and I kept getting an extra input field with the clientId as the id attribute, and I did not know why. I searched the web and did not find anybody who had ever encountered this. Since it always came last in the component I could not even figure out a way to hide the thing because any JavaScript I put in the component came prior to the existance of the field. I do not do anything in my encodeBegin() that asks for this.

Then I started wondering if extending the UIInput component required something that I was not doing; either that I figured or it was putting this darn extra field.

After studying other custom components' code, it finally occurred to me that if you extend a custom component (like UIInput) you have to be mindful of what methods that component implements, and what it does in those implemented methods. Then you have to decide if you still want that particular part of the component you are extending.

In my case, UIInput used encodeEnd() method to actually produce its field, so I just overrode encodeEnd() and made it do nothing. Then I started to wonder why I even was extending UIInput instead of UIComponent or something...

I guess that is another lesson...


I was doing some research on JSF custom components. I saw that one way to do AJAX in your custom components is to program the code needed to get your data right in your decode() in your component or in your renderer.

The problem I was having was that when I told the AJAX code to do the POST it was not acting in JSF request lifecycle like a postback had occurred. It was only running the first and last phases of this it does when you first visit a page.

The solution? Apparently JSF determines if this page was a postback by looking at all the input fields (or textarea, etc), and seeing if they have a name attribute. If they do then they need to have an entry in the post "search area" that you send as a string to the AJAX "send" command. So that includes state saving field, and any other fields that are displayed or hidden that have a name...I think.

Anyway doing this got my decode() method to be called, and the JSF lifecycle to call all the phases.

Thursday, January 8, 2009

Making Eclipse (Ganymede) Create Your Custom JSF jar file

Apparently I am an IDE man. I know it is possible to remember the flags to run the jar command so that you can package up a set of directories, but I would rather let the IDE do the work.

But I am having a bit of difficulty making Eclipse do what I want.
I decided to package up one of my custom components into a jar file, so that someone (like me) could use the component by dropping the jar into their application’s WEB-INF/lib directory.

So I moved everything my components needed to a different project, and made the project path have every library it needed to build the java files. This worked fine.

When you want to create a jar file for your custom JSF component, your jar is pretty simple. The root directory of the jar contains package trees with class files on the leaves of these trees, and resource files like message bundles or anything else you would put in the src directory to have it on the class path.

In Eclipse-ese, creating a Jar is called “export…” So if you export to a Jar by right-clicking your project, selecting Export… from the context menu, and following the instruction in the Jar export wizard when all is said and done your classes will be in the right place if you select the src directory and the build directory that eclipse manages for you. But the META-INF directory that eclipse builds for you as a sibling to the WEB-INF file cannot stay where it is if your Jar is going to have the META-INF file in the right place. The right place for the META-INF file in your jar is in the root directory of the Jar. In the jar should be your faces-config.xml and your whatever.tld file where you describe your tags.

So my solution (which worked) was to move the META-INF from being a child of the Web Content directory, to being a sibling of the Web Content directory. Then you can simply check the box next to the META-INF directory, and it is moved to the right place.

Sunday, January 4, 2009

Thoughts on JSF 1.2

Here are some miscellaneous thoughts on JSF 1.2.

The differences between JSF 1.2 and JSF 1.1 are not huge. Essentially the main differences are that you need to use objects called ValueExpressions instead of ValueBindings. Similarly you need to use MethodExpressions instead of MethodBindings. Also you will be using JSP 2.1 instead of 2.0. Also you need to use W3C XML Schema designations for your config files instead of DTD’s. Also I think you need to use a container that can handle Java EE stuff instead of J2EE stuff…but I am not sure about that. Also some classes have been deprecated in 1.2 that were in use in 1.1; for example, in the Tag Handler classes you would define for a custom component, you will not be inheriting from the UIComponentELTag instead of UIComponentTag.

You might take a look at (Vogel, L. (n.d.). JavaServer Faces 1.2 development with Eclipse WTP JSF Tooling - Tutorial. Retrieved from which shows how to get a project off the ground using JSF 1.2. I used Tomcat for my experiments. I would have liked to have also gotten it working with JDeveloper 11g since it uses a Java EE container. However I could not see an Enterprise Manager for the standalone 11g OC4J, and I did not want to learn how to use admin.jar, since that is how I supposed I would have to deploy to OC4J without EM working. Maybe now that 11g OC4J has gone into production now (I was still using a technical preview install) the EM will be in place…or maybe they are calling EM something else now…
Also Eclipse does not know how to talk to OC4J 11g yet. However it does know how to talk to Tomcat 6.0, which is compliant with JSF 1.2 and JSP 2.1 and Java EE and all that stuff. So I finally got Eclipse talking to Tomcat with all the right libraries. I put all the libraries needed in the build path and in the WEB-INF\lib path as well.

I also used Apache MyFaces JSF implementation. I think Apache Mojarra would have worked just as well, but again Eclipse may not know how to talk to GlassFish. I do not think it does. However if you want to use Apache Mojarra against other Java EE containers you are supposed to be able to do that. However, it appears to me that in order to actually deploy to any web server there is always a set libraries you need to include in order to be able to do this. It is not clear to me quite yet how to lay my hands always on this set of libraries, although I am thinking: probably the website of the app server in question…in the chapter on JSF perhaps?? Eclipse, if it knows how to deal with a server or a version of that server, will line up these magical libraries for the server if you specify what server you are using for a particular project. So if you are creating a new “Dynamic Web Project” of the JSF type, you can specify what server you want to deploy to (assuming you have set up Eclipse’s connection to your installation of whatever server you want to deploy to), and then those server-specific libraries will be lined up for you.

It looks like JSF 2.0 is in the works (ai yi yi!), so y’all better get it (and keep it) in gear!! J