Dive into Oracle ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 9:17:11 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:
 

Search BC4J JavaDoc:
 

May 2005
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Apr   Jun

Get Firefox!

Tuesday, May 17, 2005

Steven blogs about some cool new features coming in the June update of JHeadstart over on the JHeadstart blog.
4:51:40 PM    



When building web applications with Oracle ADF and Struts like the ADF Toy Store example, there is a good reason why pages are set up by default to post-back to their related data action. As part of the default ADF DataAction lifecycle, any data contained in fields on the current page's submitted form need to first be applied to the matching bindings in the current page's binding container, and then the controller layer can decide what page to navigate to, if any.

When using HTML hyperlinks that do not link-back to the same data action that goes with the page -- effectively not following the post-back pattern -- you need to be careful that any parameter names that you might pass in the URL do not match the names of any bindings in the binding container of the page you are linking to. Doing so may cause unexpected results like what I'm about to describe.

I was working with a customer last week who had a master/detail JSP page (say DeptEmp.jsp) showing dept and summary emp information. Their page contained a hyperlink to allow the user to "drill down" to see more information on the employees in that department. It looked like this:

<a href="EmpDetails.do?Deptno=<c:out value='${bindings.Deptno}'/>"
>More Info</a>

Since the current page is DeptEmp.jsp, all of the form submits and links from this page in general should post/link back to "DeptEmp.do" to follow the post-back pattern. However, this link was not and when the EmpDetails.jsp page would render, the user was sometimes seeing strange behavior. We tracked this down to the fact that the EmpDetails.jsp page contained a binding in its binding container named Deptno and this meant that the standard processUpdateModel() phase of the DataAction lifecycle for the EmpDetails data page was seeing the incoming Deptno parameter value with a matching name, and going ahead and updating the value of the Deptno binding with the value of this Deptno parameter passed in. The developer was not intending that linking to this drill-down page would update any data, but since the post-back pattern was not being used, this was an unintended side effect.

Forewarned is forarmed should you need to do this yourself. Avoid passing parameters with the same names as binding names in the target page to avoid unintentional model updating.


3:48:46 PM    


© Copyright 2008 Steve Muench.