<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-38911609</id><updated>2011-07-08T03:27:07.830+05:00</updated><category term='File Download'/><category term='ADF Faces'/><category term='Asim Ghaffar'/><category term='Java'/><category term='File Upload'/><category term='Toplink'/><category term='Shaghab'/><title type='text'>&gt;= Jdeveloper 10.1.3</title><subtitle type='html'>I basically play with ADF Faces/Toplink/SessionBean combo. Here i will post solution/work-arounds for newbie issues (that i faced).</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jdev1013.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jdev1013.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>SHAGH'AB</name><uri>http://www.blogger.com/profile/09573969745313606941</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://photos1.blogger.com/x/blogger/3328/425/200/843530/asim-rawal.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-38911609.post-5491058169880717870</id><published>2009-08-23T20:15:00.005+06:00</published><updated>2009-08-23T22:51:36.483+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asim Ghaffar'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='File Upload'/><category scheme='http://www.blogger.com/atom/ns#' term='Toplink'/><category scheme='http://www.blogger.com/atom/ns#' term='Shaghab'/><category scheme='http://www.blogger.com/atom/ns#' term='ADF Faces'/><category scheme='http://www.blogger.com/atom/ns#' term='File Download'/><title type='text'>File upload and download in Toplink, ADF Faces, Oracle 11g and JDeveloper 10g (10.1.3.3)</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_DmqtXSc0R28/SpFWcn26PTI/AAAAAAAAACo/i2UxAoyoO_E/s1600-h/file.PNG"&gt;&lt;img style="MARGIN: 0px 0px 10px 10px; WIDTH: 400px; FLOAT: right; HEIGHT: 198px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5373170880165330226" border="0" alt="" src="http://4.bp.blogspot.com/_DmqtXSc0R28/SpFWcn26PTI/AAAAAAAAACo/i2UxAoyoO_E/s400/file.PNG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Application is simple; you upload files to Oracle database. Uploaded files are shown in a grid. To download a file, you simply click on link in the code column.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;I have tried hard to write this blog-entry in detail, but still if there is anything you wanna ask then just email me at asim.ghaffar@gmail.com or simply add a comment.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span xmlns=""&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;h2&gt;Create Database&lt;br /&gt;&lt;/h2&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;h3&gt;Schema&lt;br /&gt;&lt;/h3&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;CREATE USER file_example&lt;br /&gt;IDENTIFIED BY "12"&lt;br /&gt;DEFAULT TABLESPACE users&lt;br /&gt;TEMPORARY TABLESPACE temp&lt;br /&gt;PROFILE DEFAULT&lt;br /&gt;ACCOUNT UNLOCK;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;GRANT CONNECT TO file_example;&lt;br /&gt;GRANT RESOURCE TO file_example;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;h3&gt;Table&lt;br /&gt;&lt;/h3&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;CREATE TABLE file_example.x_files&lt;br /&gt;(&lt;br /&gt;file_code NUMBER(38),&lt;br /&gt;file_name VARCHAR2(256 BYTE),&lt;br /&gt;file_content BLOB,&lt;br /&gt;file_type VARCHAR2(50 BYTE),&lt;br /&gt;file_size NUMBER(38),&lt;br /&gt;CONSTRAINT x_files_pk PRIMARY KEY (file_code)&lt;br /&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;In this example, file_code is the primary key It is basically a hash-value of uploaded file's contents calculated using Java Arrays.hashCode(Byte[]). This ensures that a same file cannot be added more than once.&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;h2&gt;Create JDeveloper Application&lt;br /&gt;&lt;/h2&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;h3&gt;Basic Application&lt;br /&gt;&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press (Ctrl + n) to open &lt;strong&gt;New Gallery&lt;/strong&gt; dialogue.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Categories&lt;/strong&gt; pan on the left, select &lt;strong&gt;General&lt;/strong&gt; (if not already selected).&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Items&lt;/strong&gt; pan on the right, select &lt;strong&gt;Application&lt;/strong&gt; (if not already selected).&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Ok&lt;/strong&gt; button.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Create Application&lt;/strong&gt; dialogue should appear. Fill it as following.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Application name: &lt;strong&gt;Cabinet&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Application Package Prefix:&lt;strong&gt; cabinet&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Application Template: &lt;strong&gt;Web Application [JSF, EJB, Toplink]&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;You should be seeing newly created project under &lt;strong&gt;Applications&lt;/strong&gt; node in the &lt;strong&gt;Application Navigator&lt;/strong&gt; window. If the window is not open press (Ctrl+Shift+A).&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Application Navigator&lt;/strong&gt; select &lt;strong&gt;Model&lt;/strong&gt; project of the newly created application. Press (Ctrl + n) to open &lt;strong&gt;New Gallery&lt;/strong&gt; dialogue.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Categories&lt;/strong&gt; pan on the left, select &lt;strong&gt;Business Tier -&amp;gt; TopLink&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Items&lt;/strong&gt; pan on the right, select &lt;strong&gt;Java Objects from Tables&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Ok&lt;/strong&gt; button.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Multistep dialogue will appear &lt;strong&gt;Create Java Objects from Tables &lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 1 of 4: Select DB Connection&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Click on the new button in row of &lt;strong&gt;Connection&lt;/strong&gt; or press (Alt + w)&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Connection Name: &lt;strong&gt;file_conn&lt;/strong&gt;, Connection Type: &lt;strong&gt;Oracle (JDBC)&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Username: &lt;strong&gt;file_example&lt;/strong&gt;, Password: &lt;strong&gt;12&lt;/strong&gt;, Deploy password: &lt;strong&gt;[CHECKED]&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Driver: &lt;strong&gt;thin&lt;/strong&gt;, Host Name: &lt;strong&gt;localhost&lt;/strong&gt;, JDBC port: &lt;strong&gt;1521&lt;/strong&gt;, SID: &lt;strong&gt;ORCL&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;This should reflect your DBMS specific values. Above should hold if you installed DB yourself on your machine with default SID.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Test to verify. Else see what you missed in 2 or 3.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press Finish&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Click on the new button in row of &lt;strong&gt;Toplink Map&lt;/strong&gt; or press (Alt + .)&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;ToplLink Map Name: &lt;strong&gt;tlMap1&lt;/strong&gt;, Connection: &lt;strong&gt;file_conn, &lt;/strong&gt;Database platform: &lt;strong&gt;Oracle 10g&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Ok&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 2 of 4: Select Tables&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press Query or [CHECK] Auto-Query.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Move table &lt;strong&gt;X_FILES&lt;/strong&gt; from &lt;strong&gt;Available&lt;/strong&gt; to &lt;strong&gt;Selected&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 3 of 4: General Options&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 4 of 4: Specifiy Object Details&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Fnish&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Application Navigator&lt;/strong&gt; select &lt;strong&gt;Model&lt;/strong&gt; project of the newly created application. Press (Ctrl + n) to open &lt;strong&gt;New Gallery&lt;/strong&gt; dialogue.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Categories&lt;/strong&gt; pan on the left, select &lt;strong&gt;Business Tier -&amp;gt; EJB&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Items&lt;/strong&gt; pan on the right, select &lt;strong&gt;Session Bean (EJB 1.1/2.x/3.0)&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;If you are using other version of JDeveloper than 10.1.3.3 and you don't have this item available then choose the one which says Session Bean and Version 3.0.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Ok&lt;/strong&gt; button.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Multistep dialogue will appear &lt;strong&gt;Create Java Objects from Tables&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 1 of 4: EJB Name and Options&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;EJB Name: &lt;strong&gt;SessionEJB&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Session Type: &lt;strong&gt;Stateless&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Transaction Type: &lt;strong&gt;Container&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Generate Session Façade Methods:&lt;strong&gt; [CHECKED]&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Entity Implementation: &lt;strong&gt;TopLink POJOs&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 2 or 4: Session Façade – Select Service Methods&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;[Check All]&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 3 or 4: Class Definitions&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 4 or 4: Class Definitions&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Implement a Remote Interface: &lt;strong&gt;[UNCHECKED]&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Implement a Local Interface:&lt;strong&gt; [CHECKED]&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Include Web Service Endpoint Interface:&lt;strong&gt; [Unchecked]&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Finish&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Application Navigator&lt;/strong&gt; select &lt;strong&gt;ViewController&lt;/strong&gt; project of the newly created application. Press (Ctrl + n) to open &lt;strong&gt;New Gallery&lt;/strong&gt; dialogue.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Categories&lt;/strong&gt; pan on the left, select &lt;strong&gt;Web Tier -&amp;gt; JSF&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Items&lt;/strong&gt; pan on the right, select &lt;strong&gt;JSF JSP&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Ok&lt;/strong&gt; button.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Multistep dialogue will appear &lt;strong&gt;Create JSF JSP&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 1 of 4: JSP File&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;File Name: &lt;strong&gt;index.jspx&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Type: &lt;strong&gt;[JSP Document (*.jspx)]]&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Add Mobile Support:&lt;strong&gt; [UNCHECKED]&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 2 or 4: Component Binding&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Select &lt;strong&gt;[Do Not Automatically Expose UI Components in a Managed Bean]&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 3 or 4: Tag Libraries&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Filter by &lt;strong&gt;Project Technologies.&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Move these from available libraries to selected Libraries.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;ADF Faces Component 10_1_3_3_0&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;ADF Faces HTML 10_1_3_3_0&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;JSF Core 1.0&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;JSF HTML 1.0&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Step 4 or 4: HTML Options&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;HTML Version:&lt;strong&gt; 4.0.1 Transitional&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Title: Index&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Finish&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;h3&gt;Model Project enhancement to complete example application&lt;br /&gt;&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Application Navigator&lt;/strong&gt; collapse tree for &lt;strong&gt;Model&lt;/strong&gt; project and double click &lt;strong&gt;Application Sources &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; cabinet.model.SessionEjbBean.java&lt;/strong&gt; to open it in the editor. Add following:&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;public Integer saveXFile(String fileName,byte[] fileContent,int filesize,String filetype){&lt;br /&gt;int code=Arrays.hashCode(fileContent);&lt;br /&gt;XFiles list=findXFiles(code);&lt;br /&gt;if(list!=null) {&lt;br /&gt;System.err.println("File already exist");&lt;br /&gt;return code;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;list=new XFiles();&lt;br /&gt;list.setFileName(fileName);&lt;br /&gt;list.setFileContent(fileContent);&lt;br /&gt;list.setFileSize((double)filesize);&lt;br /&gt;list.setFileType(filetype);&lt;br /&gt;list.setFileCode((double)code);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;try{&lt;br /&gt;persistEntity(list);&lt;br /&gt;} catch(Exception e){&lt;br /&gt;e.printStackTrace();&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;return code;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;public XFiles findXFiles(int code){&lt;br /&gt;Session sess=getSessionFactory().acquireSession();&lt;br /&gt;Expression exp=new ExpressionBuilder().get("fileCode").equal(code);&lt;br /&gt;XFiles list=(XFiles)sess.readObject(XFiles.class,exp);&lt;br /&gt;sess.release();&lt;br /&gt;return list;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;While in &lt;strong&gt;SessionEjbBean.java&lt;/strong&gt;, press (Ctrl+Shift+S) to open structure window. Collapse Sources, and double click on &lt;strong&gt;SessionEJBLocal.java&lt;/strong&gt; to open it in the editor. Add following:&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;Integer saveXFile(String fileName,byte[] fileContent,int filesize,String filetype);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;XFiles findXFiles(int code);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Application Navigator&lt;/strong&gt; collapse tree for &lt;strong&gt;Model&lt;/strong&gt; project and select &lt;strong&gt;Application Sources &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; cabinet.model.SessionEjbBean.java&lt;/strong&gt;. Right click on the file and choose option &lt;strong&gt;Create Data Control.&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;h3&gt;ViewController Project enhancement to complete example application&lt;br /&gt;&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Application Navigator&lt;/strong&gt; collapse tree for &lt;strong&gt;ViewController&lt;/strong&gt; project and double click &lt;strong&gt;web Content &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; index.jspx&lt;/strong&gt; to open it in the editor. Choose Design view.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;From Data Control Palette, drag and drop &lt;strong&gt;SessionEJBLocal &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; findAllXFiles() &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; XFiles&lt;/strong&gt; at center of open page. Use option &lt;strong&gt;Tables &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; ADF Read-only Table…&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;You will get a notification &lt;strong&gt;Client Project Libraries Added&lt;/strong&gt;, if this is the first page on which you are dropping a data control.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Click anywhere on page and press (Ctrl + Shift + S).&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In Structure window navigate to &lt;strong&gt;jsp:root &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; f:view &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:html &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:body &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; h:form &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; af:table&lt;/strong&gt; and then double click on it to open &lt;strong&gt;Table Properties&lt;/strong&gt; dialogue.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;On Column Summary tab, rename Column headers&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;#{bindings.findAllXFiles1.labels.fileCode} &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; Code&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;#{bindings.findAllXFiles1.labels.fileName} &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; Name&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;#{bindings.findAllXFiles1.labels.fileSize} &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; File Size&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;#{bindings.findAllXFiles1.labels.fileType} &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; File Type&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;On same tab, change Component of first row (value=#{row.fileCode})&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;af:outputText &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; af:commandLink&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;OK&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In Structure window navigate to &lt;strong&gt;jsp:root &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; f:view &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:html &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:body &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; h:form &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; af:table &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; af:column – Code &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; af:commandLink - #{row.fileCode} &lt;/strong&gt;and then press (Ctrl + Shift + I) to open Property Inspector.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Action&lt;/strong&gt; property write &lt;span style="font-family:Courier New;"&gt;#{backing_index.download}&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In Structure window navigate to &lt;strong&gt;jsp:root &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; f:view &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:html &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:body &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; h:form&lt;/strong&gt; and then right click on it and choose &lt;strong&gt;Convert&lt;/strong&gt; option. &lt;strong&gt;Convert Form&lt;/strong&gt; dialogue will open.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;From &lt;strong&gt;ADF Faces Core&lt;/strong&gt; category choose &lt;strong&gt;Form&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;OK&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;With &lt;strong&gt;af:form&lt;/strong&gt; still selected press (Ctrl + Shift + I) to open Property Inspector.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;UsesUpload&lt;/strong&gt; choose &lt;strong&gt;true. &lt;span style="color:red;"&gt;(IMPORTANT)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Click anywhere on page. Press (Ctrl + Shift + P) to open &lt;strong&gt;Component Palette.&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;From Component Palette, drag and drop &lt;strong&gt;ADF Faces Core &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; InputFile&lt;/strong&gt; at center of open page. New Component will appear below existing Table.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;With newly added component selected press (Ctrl + Shift + I) to open Property Inspector.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Label&lt;/strong&gt; property remove existing text i.e. &lt;strong&gt;Label 1&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Value&lt;/strong&gt; property enter &lt;span style="font-family:Courier New;"&gt;#{backing_index.uploadedFile}&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Click anywhere on page. Press (Ctrl + Shift + P) to open &lt;strong&gt;Component Palette.&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;From Component Palette, drag and drop &lt;strong&gt;ADF Faces Core &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; CommandButton&lt;/strong&gt; at center of open page. New Component will appear below existing File Input Compoent.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;With newly added component selected press (Ctrl + Shift + I) to open Property Inspector.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Text&lt;/strong&gt; property replace existing text with &lt;strong&gt;Upload&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In Structure window navigate to &lt;strong&gt;jsp:root &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; f:view &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:html &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:body &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; h:form&lt;/strong&gt; and then (Ctrl) select &lt;strong&gt;af:inputFile&lt;/strong&gt; and &lt;strong&gt;af:commandButton - Upload&lt;/strong&gt;. Right click on the selection and choose &lt;strong&gt;Surround With. Surround With&lt;/strong&gt; dialogue will open.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;From &lt;strong&gt;ADF Faces Core&lt;/strong&gt; category choose &lt;strong&gt;PanelHorizontal&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;OK&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In Structure window navigate to &lt;strong&gt;jsp:root &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; f:view &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:html &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; afh:body &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; h:form &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; af:table &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; af:column – Code &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; af:commandLink - #{row.fileCode} &lt;/strong&gt;and then right click and choose &lt;strong&gt;Insert inside of af:commandLink - #{row.fileCode} &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; ADF Faces Core&lt;/strong&gt;. &lt;strong&gt;Insert ADF Faces Core Item&lt;/strong&gt; dialogue will appear.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;From &lt;strong&gt;ADF Faces Core&lt;/strong&gt; category choose &lt;strong&gt;SetActionListener&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;OK. &lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Insert SetActionaListener &lt;/strong&gt;dialogue will appear. Add following values&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;From: #{row.fileCode}&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;To: #{backing_index.fileCode}&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="TEXT-ALIGN: justify"&gt;Now we need a backing bean. For this we will create a file and then add relevant information in faces-config.&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Application Navigator&lt;/strong&gt; select ViewController project of the newly created application. Press (Ctrl + n) to open &lt;strong&gt;New Gallery&lt;/strong&gt; dialogue.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Categories&lt;/strong&gt; pan on the left, select &lt;strong&gt;General&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In the &lt;strong&gt;Items&lt;/strong&gt; pan on the right, select &lt;strong&gt;Java Class.&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Copy paste Index.java code from next section: Complete Source&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;Ok&lt;/strong&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Create Java Class&lt;/strong&gt; dialogue will appear&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Set following values&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Name: Index&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Package: cabinet.view&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Public: [CHECKED]&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Generate Default Constructor: [UNCHECKED]&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Generate Main Method: [UNCHECKED]&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Press &lt;strong&gt;OK&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;In &lt;strong&gt;Application Navigator&lt;/strong&gt; collapse tree for &lt;strong&gt;ViewController&lt;/strong&gt; project and double click &lt;strong&gt;web Content &lt;span style="font-family:Wingdings;"&gt;à&lt;/span&gt; faces-config.xml&lt;/strong&gt; to open it in the editor. Choose &lt;strong&gt;Source&lt;/strong&gt; view.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Before last tag &lt;strong&gt;&amp;lt;/faces-config&amp;gt;&lt;/strong&gt; add these lines&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:Courier New;"&gt;&amp;lt;managed-bean&amp;gt;&lt;br /&gt;&amp;lt;managed-bean-name&amp;gt;backing_index&amp;lt;/managed-bean-name&amp;gt;&lt;br /&gt;&amp;lt;managed-bean-class&amp;gt;cabinet.view.Index&amp;lt;/managed-bean-class&amp;gt;&lt;br /&gt;&amp;lt;managed-bean-scope&amp;gt;request&amp;lt;/managed-bean-scope&amp;gt;&lt;br /&gt;&amp;lt;managed-property&amp;gt;&lt;br /&gt;&amp;lt;property-name&amp;gt;bindings&amp;lt;/property-name&amp;gt;&lt;br /&gt;&amp;lt;value&amp;gt;#{bindings}&amp;lt;/value&amp;gt;&lt;br /&gt;&amp;lt;/managed-property&amp;gt;&lt;br /&gt;&amp;lt;/managed-bean&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h1&gt;Complete Source&lt;br /&gt;&lt;/h1&gt;&lt;h2&gt;index.jspx&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&amp;lt;?xml version='1.0' encoding='windows-1252'?&amp;gt;&lt;br /&gt;&amp;lt;jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" xmlns:f="http://java.sun.com/jsf/core"&lt;br /&gt;xmlns:af="http://xmlns.oracle.com/adf/faces" xmlns:afh="http://xmlns.oracle.com/adf/faces/html"&amp;gt;&lt;br /&gt;&amp;lt;jsp:output omit-xml-declaration="true" doctype-root-element="HTML" doctype-system="http://www.w3.org/TR/html4/loose.dtd"&lt;br /&gt;doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/&amp;gt;&lt;br /&gt;&amp;lt;jsp:directive.page contentType="text/html;charset=windows-1252"/&amp;gt;&lt;br /&gt;&amp;lt;f:view&amp;gt;&lt;br /&gt;&amp;lt;afh:html&amp;gt;&lt;br /&gt;&amp;lt;afh:head title="Index"&amp;gt;&lt;br /&gt;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/&amp;gt;&lt;br /&gt;&amp;lt;/afh:head&amp;gt;&lt;br /&gt;&amp;lt;afh:body&amp;gt;&lt;br /&gt;&amp;lt;af:messages/&amp;gt;&lt;br /&gt;&amp;lt;af:form usesUpload="true"&amp;gt;&lt;br /&gt;&amp;lt;af:table value="#{bindings.findAllXFiles1.collectionModel}" var="row" rows="#{bindings.findAllXFiles1.rangeSize}" first="#{bindings.findAllXFiles1.rangeStart}"&lt;br /&gt;emptyText="#{bindings.findAllXFiles1.viewable ? 'No rows yet.' : 'Access Denied.'}"&amp;gt;&lt;br /&gt;&amp;lt;af:column sortProperty="fileCode" sortable="false" headerText="Code"&amp;gt;&lt;br /&gt;&amp;lt;af:commandLink text="#{row.fileCode}" action="#{backing_index.download}"&amp;gt;&lt;br /&gt;&amp;lt;af:setActionListener from="#{row.fileCode}" to="#{backing_index.fileCode}"/&amp;gt;&lt;br /&gt;&amp;lt;/af:commandLink&amp;gt;&lt;br /&gt;&amp;lt;/af:column&amp;gt;&lt;br /&gt;&amp;lt;af:column sortProperty="fileName" sortable="false" headerText="Name"&amp;gt;&lt;br /&gt;&amp;lt;af:outputText value="#{row.fileName}"/&amp;gt;&lt;br /&gt;&amp;lt;/af:column&amp;gt;&lt;br /&gt;&amp;lt;af:column sortProperty="fileSize" sortable="false" headerText="File Size"&amp;gt;&lt;br /&gt;&amp;lt;af:outputText value="#{row.fileSize}"&amp;gt;&lt;br /&gt;&amp;lt;f:convertNumber groupingUsed="false" pattern="#{bindings.findAllXFiles1.formats.fileSize}"/&amp;gt;&lt;br /&gt;&amp;lt;/af:outputText&amp;gt;&lt;br /&gt;&amp;lt;/af:column&amp;gt;&lt;br /&gt;&amp;lt;af:column sortProperty="fileType" sortable="false" headerText="File Type"&amp;gt;&lt;br /&gt;&amp;lt;af:outputText value="#{row.fileType}"/&amp;gt;&lt;br /&gt;&amp;lt;/af:column&amp;gt;&lt;br /&gt;&amp;lt;/af:table&amp;gt;&lt;br /&gt;&amp;lt;af:panelHorizontal&amp;gt;&lt;br /&gt;&amp;lt;af:inputFile value="#{backing_index.uploadedFile}"/&amp;gt;&lt;br /&gt;&amp;lt;af:commandButton text="Upload"/&amp;gt;&lt;br /&gt;&amp;lt;/af:panelHorizontal&amp;gt;&lt;br /&gt;&amp;lt;/af:form&amp;gt;&lt;br /&gt;&amp;lt;/afh:body&amp;gt;&lt;br /&gt;&amp;lt;/afh:html&amp;gt;&lt;br /&gt;&amp;lt;/f:view&amp;gt;&lt;br /&gt;&amp;lt;/jsp:root&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;faces-config.xml&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&amp;lt;?xml version="1.0" encoding="windows-1252"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE faces-config PUBLIC&lt;br /&gt;"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"&lt;br /&gt;"http://java.sun.com/dtd/web-facesconfig_1_1.dtd"&amp;gt;&lt;br /&gt;&amp;lt;faces-config xmlns="http://java.sun.com/JSF/Configuration"&amp;gt;&lt;br /&gt;&amp;lt;application&amp;gt;&lt;br /&gt;&amp;lt;default-render-kit-id&amp;gt;oracle.adf.core&amp;lt;/default-render-kit-id&amp;gt;&lt;br /&gt;&amp;lt;/application&amp;gt;&lt;br /&gt;&amp;lt;lifecycle&amp;gt;&lt;br /&gt;&amp;lt;phase-listener&amp;gt;oracle.adf.controller.faces.lifecycle.ADFPhaseListener&amp;lt;/phase-listener&amp;gt;&lt;br /&gt;&amp;lt;/lifecycle&amp;gt;&lt;br /&gt;&amp;lt;managed-bean&amp;gt;&lt;br /&gt;&amp;lt;managed-bean-name&amp;gt;backing_index&amp;lt;/managed-bean-name&amp;gt;&lt;br /&gt;&amp;lt;managed-bean-class&amp;gt;cabinet.view.Index&amp;lt;/managed-bean-class&amp;gt;&lt;br /&gt;&amp;lt;managed-bean-scope&amp;gt;request&amp;lt;/managed-bean-scope&amp;gt;&lt;br /&gt;&amp;lt;managed-property&amp;gt;&lt;br /&gt;&amp;lt;property-name&amp;gt;bindings&amp;lt;/property-name&amp;gt;&lt;br /&gt;&amp;lt;value&amp;gt;#{bindings}&amp;lt;/value&amp;gt;&lt;br /&gt;&amp;lt;/managed-property&amp;gt;&lt;br /&gt;&amp;lt;/managed-bean&amp;gt;&lt;br /&gt;&amp;lt;/faces-config&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;Index.java&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;package cabinet.view;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;import cabinet.model.SessionEJBLocal;&lt;br /&gt;import cabinet.model.XFiles;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.io.InputStream;&lt;br /&gt;import javax.faces.context.FacesContext;&lt;br /&gt;import javax.faces.el.ValueBinding;&lt;br /&gt;import javax.servlet.ServletOutputStream;&lt;br /&gt;import javax.servlet.http.HttpServletResponse;&lt;br /&gt;import oracle.adf.view.faces.model.UploadedFile;&lt;br /&gt;import oracle.binding.BindingContainer;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public class Index{&lt;br /&gt;private BindingContainer bindings;&lt;br /&gt;private UploadedFile uploadedFile;&lt;br /&gt;private Double fileCode;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public BindingContainer getBindings(){&lt;br /&gt;return this.bindings;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public void setBindings(BindingContainer bindings){&lt;br /&gt;this.bindings=bindings;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public void setFileCode(Double fileCode){&lt;br /&gt;this.fileCode=fileCode;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public Double getFileCode(){&lt;br /&gt;return fileCode;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public void setUploadedFile(UploadedFile uploadedFile){&lt;br /&gt;this.uploadedFile=uploadedFile;&lt;br /&gt;try{&lt;br /&gt;Integer code=uploadFile(uploadedFile);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;// To refresh table&lt;br /&gt;bindings.getOperationBinding("findAllXFiles").execute();&lt;br /&gt;} catch(IOException e){&lt;br /&gt;e.printStackTrace();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public UploadedFile getUploadedFile(){&lt;br /&gt;return uploadedFile;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public String download(){&lt;br /&gt;if(fileCode!=null)&lt;br /&gt;try{&lt;br /&gt;XFiles atchmn=getEJBLocal().findXFiles(fileCode.intValue());&lt;br /&gt;if(atchmn==null)&lt;br /&gt;return null;&lt;br /&gt;downloadFile(atchmn);&lt;br /&gt;} catch(Exception ex){&lt;br /&gt;ex.printStackTrace();&lt;br /&gt;}&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public static Integer uploadFile(UploadedFile file) throws IOException{&lt;br /&gt;byte[] array=new byte[(int)file.getLength()];&lt;br /&gt;InputStream in=file.getInputStream();&lt;br /&gt;int offset=0;&lt;br /&gt;int numRead=0;&lt;br /&gt;do{&lt;br /&gt;numRead=in.read(array,offset,array.length-offset);&lt;br /&gt;offset+=2048;&lt;br /&gt;} while(numRead!=-1);&lt;br /&gt;Integer code=getEJBLocal().saveXFile(file.getFilename(),array,(int)file.getLength(),file.getContentType());&lt;br /&gt;return code;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public static void downloadFile(XFiles atchmn){&lt;br /&gt;String fname=atchmn.getFileName();&lt;br /&gt;byte[] pdf=atchmn.getFileContent();&lt;br /&gt;FacesContext faces=FacesContext.getCurrentInstance();&lt;br /&gt;HttpServletResponse response=(HttpServletResponse)faces.getExternalContext().getResponse();&lt;br /&gt;response.setContentType(atchmn.getFileType());&lt;br /&gt;response.setContentLength(atchmn.getFileSize().intValue());&lt;br /&gt;response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");&lt;br /&gt;response.setHeader("Pragma","public");&lt;br /&gt;response.setHeader("Content-disposition","attachment; filename=\""+fname+"\"");&lt;br /&gt;try{&lt;br /&gt;ServletOutputStream out;&lt;br /&gt;out=response.getOutputStream();&lt;br /&gt;out.write(pdf);&lt;br /&gt;} catch(IOException ex){&lt;br /&gt;ex.printStackTrace();&lt;br /&gt;}&lt;br /&gt;faces.responseComplete();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public static Object getELObj(String s){&lt;br /&gt;FacesContext fc=FacesContext.getCurrentInstance();&lt;br /&gt;ValueBinding vb=fc.getApplication().createValueBinding(s);&lt;br /&gt;return vb.getValue(fc);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;public static SessionEJBLocal getEJBLocal(){&lt;br /&gt;try{&lt;br /&gt;SessionEJBLocal ejb=(SessionEJBLocal)getELObj("#{data.SessionEJBLocal.dataProvider}");&lt;br /&gt;return ejb;&lt;br /&gt;} catch(Exception ex){&lt;br /&gt;ex.printStackTrace();&lt;br /&gt;}&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;Note:&lt;br /&gt;&lt;/h3&gt;&lt;p style="TEXT-ALIGN: justify"&gt;If in Index.java you get error on &lt;strong&gt;oracle.binding.BindingContainer&lt;/strong&gt; then this means certain required libraries are not added to your project&lt;strong&gt;. &lt;/strong&gt;When you drag and drop control from Data Control Palette these libraries are automatically added.&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38911609-5491058169880717870?l=jdev1013.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jdev1013.blogspot.com/feeds/5491058169880717870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38911609&amp;postID=5491058169880717870' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/5491058169880717870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/5491058169880717870'/><link rel='alternate' type='text/html' href='http://jdev1013.blogspot.com/2009/08/file-upload-and-download-in-toplink-adf.html' title='File upload and download in Toplink, ADF Faces, Oracle 11g and JDeveloper 10g (10.1.3.3)'/><author><name>SHAGH'AB</name><uri>http://www.blogger.com/profile/09573969745313606941</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://photos1.blogger.com/x/blogger/3328/425/200/843530/asim-rawal.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DmqtXSc0R28/SpFWcn26PTI/AAAAAAAAACo/i2UxAoyoO_E/s72-c/file.PNG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38911609.post-5748933474216709630</id><published>2008-07-23T22:23:00.004+06:00</published><updated>2008-07-23T22:45:06.620+06:00</updated><title type='text'>Avoid ADF Table selection-state reset</title><content type='html'>&lt;span xmlns=""&gt;&lt;p style="TEXT-ALIGN: justify"&gt;This is a small code snippet on how to avoid selection-state reset of an ADF table when the underlying method is re-queried.&lt;br /&gt;&lt;/p&gt;&lt;p style="TEXT-ALIGN: justify"&gt;Assuming that you have a Master-Detail situation. Lets says, you have a &lt;strong&gt;&lt;em&gt;methodAction&lt;/em&gt;&lt;/strong&gt; e.g. id="findAllItems" and an associated &lt;strong&gt;&lt;em&gt;methodIterator&lt;/em&gt;&lt;/strong&gt; e.g. id="findAllItemsIter", then following is the code snippet that you can use in the page's managed backing bean to avoid selection-state reset.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;public void refreshButRetainSelection(){&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;CoreTable table=this.getMasterTable();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;RowKeySet rowSet=table.getSelectionState();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;OperationBinding operationBinding=&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;bindings.getOperationBinding("findAllItems");&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;operationBinding.execute(); // requery&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;table.setSelectionState(rowSet);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;Set keySet=table.getSelectionState().getKeySet();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;Iterator rowSetIter=keySet.iterator();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;DCIteratorBinding iterBinding&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;=&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;(DCIteratorBinding)bindings.get("findAllItemsIter");&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;while(rowSetIter.hasNext()){&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;Key key=(Key)rowSetIter.next();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;iterBinding.setCurrentRowWithKey(key.toStringFormat(true));&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;}&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38911609-5748933474216709630?l=jdev1013.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jdev1013.blogspot.com/feeds/5748933474216709630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38911609&amp;postID=5748933474216709630' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/5748933474216709630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/5748933474216709630'/><link rel='alternate' type='text/html' href='http://jdev1013.blogspot.com/2008/07/avoid-adf-table-selection-state-reset.html' title='Avoid ADF Table selection-state reset'/><author><name>SHAGH'AB</name><uri>http://www.blogger.com/profile/09573969745313606941</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://photos1.blogger.com/x/blogger/3328/425/200/843530/asim-rawal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38911609.post-2192909525156945140</id><published>2008-01-26T19:10:00.001+05:00</published><updated>2008-01-26T23:24:10.103+05:00</updated><title type='text'>TOPLINK SORTING: How to</title><content type='html'>-- all code tested on Jdeveloper 10.1.3&lt;br /&gt;One of the first queries I had when I started working with Toplink was how to get sorted results. Here are few techniques that may help newbies (especially the tip at the end regarding &lt;span style="color:#666666;"&gt;&lt;strong&gt;child collections sorting&lt;/strong&gt;&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;All example will be given using a two table schema:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;CREATE TABLE ACCOUNTS (&lt;br /&gt;LOGIN VARCHAR2(10) NOT NULL PRIMARY KEY,&lt;br /&gt;PASSWORD VARCHAR2(20),&lt;br /&gt;CREATED DATE);&lt;br /&gt;&lt;br /&gt;CREATE TABLE LOGINS(&lt;br /&gt;ACCOUNTS_LOGIN VARCHAR2(10) NOT NULL PRIMARY KEY, -- FK pointing to ACCOUNT-&gt;LOGIN&lt;br /&gt;LOGIN_TIME DATE NOT NULL PRIMARY KEY,&lt;br /&gt;LOGOUT_TIME DATE,&lt;br /&gt;COMPUTER VARCHAR2(30));&lt;br /&gt;&lt;br /&gt;ALTER TABLE LOGINS ADD CONSTRAINT&lt;br /&gt;LOGINS_ACCOUNTS_FK FOREIGN KEY(ACCOUNTS_LOGIN)REFERENCES ACCOUNTS(LOGIN) ENABLE;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For rest of the article, I will assume you have generated pojo using toplink over above mentioned tables.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;&lt;span style="color:#990000;"&gt;Sorting Toplink Named Queries&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;Named queries can be sorted using “AfterLoad” technique.&lt;br /&gt;&lt;br /&gt;Let say you have a readAllquery findAllLoginsOf that takes a parameter login (String). A expression is defined as 1. accountsLogin EQUAL login. This query will return all logins by a particular user - without sorting. To add sorting do this:&lt;br /&gt;&lt;br /&gt;1. Create static function (This can be any class e.g. MyAfterLoads)&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;public static void afterLoadLogins(ClassDescriptor descriptor){ &lt;span style="color:#6666cc;"&gt;// Again, name of method is immaterial.&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#6666cc;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;ReadAllQuery raq=(ReadAllQuery)descriptor.getDescriptorQueryManager().getQuery("findAllLogins");&lt;span style="color:#6666cc;"&gt;// Default query generated using Toplink POJO creations &lt;/span&gt;&lt;br /&gt;raq.addAscendingOrdering("loginTime");&lt;br /&gt;raq=(ReadAllQuery)descriptor.getDescriptorQueryManager().getQuery("findAllLoginsOf");&lt;span style="color:#6666cc;"&gt;// Our query&lt;br /&gt;&lt;/span&gt;raq.addAscendingOrdering("loginTime");&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;2. In Structure window right click on the Logins descriptor. (You will need to first select Toplink map file using the application navigator first).&lt;br /&gt;&lt;br /&gt;3. Through the context menu choose Advanced Properties -&gt; After Load&lt;br /&gt;&lt;br /&gt;4. Point to the class MyAfterLoads and choose from the drop-down your method. Note: In earlier versions of jdev 10.1.3 there is a bug. So if your method des not appear in the list you may need to open up the class MyAfterLoads choose “Reformat”.&lt;br /&gt;&lt;br /&gt;That is all. Note that you can have different sorting for different named queries.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;&lt;span style="color:#990000;"&gt;Sorting Toplink Direct Queries&lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;In case you writing Toplink queries directly in java then there is a way for sorting there as well. Taking the same example i.e. findAllLoginsOf, a common way to query it will be:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#6666cc;"&gt;// LIST (A)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Session session=getSessionFactory().acquireSession();&lt;br /&gt;ExpressionBuilder builder=new ExpressionBuilder();&lt;br /&gt;Expression exp=builder.get("accountsLogin").equal(user);&lt;br /&gt;List&lt;logins&gt; account=(List&lt;logins&gt;)&lt;strong&gt;session.readAllObjects(Logins.class,exp);&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;However this will return unsorted list. To sort you will need to use the following code. Notice that instead of readAllObject now I am using executeQuery. Bold is the different part in list A &amp;amp; list B.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#6666cc;"&gt;// LIST (B)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Session session=getSessionFactory().acquireSession();&lt;br /&gt;ExpressionBuilder builder=new ExpressionBuilder();&lt;br /&gt;Expression exp=builder.get("accountsLogin").equal(user);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;strong&gt;ReadAllQuery query=new ReadAllQuery(builder);&lt;br /&gt;query.setReferenceClass(Logins.class);&lt;br /&gt;query.addAscendingOrdering("loginTime");&lt;br /&gt;query.setSelectionCriteria(exp);&lt;/strong&gt;&lt;br /&gt;List&lt;logins&gt; logins=(List&lt;logins&gt;)&lt;strong&gt;session.executeQuery(query);&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#990000;"&gt;&lt;strong&gt;Sorting Java Entities&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;You can always do sorting using java Collections i.e. implement Comparable in your POJO (In our case that would be class Logins). We will have something like this after implementing&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;public int compareTo(Object o){&lt;br /&gt;Logins that = (Logins) o;&lt;br /&gt;return this.getLoginTime().compareTo(that.getLoginTime());&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Now when you have your collection then all you need to do is to pass it to Collections.sort(List). So list A can be modified as (modification in bold):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Session session=getSessionFactory().acquireSession();&lt;br /&gt;ExpressionBuilder builder=new ExpressionBuilder();&lt;br /&gt;Expression exp=builder.get("accountsLogin").equal(user);&lt;br /&gt;List&lt;logins&gt; account=(List&lt;logins&gt;)session.readAllObjects(Logins.class,exp);&lt;br /&gt;&lt;strong&gt;logins = (List&lt;logins&gt;)Collections.sort(account);&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The main strength (or weakness) of this particular java technique is that you have only one sorting criteria per table. There are other java techniques as well that give you more options in this regard.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;color:#990000;"&gt;Sorting Child Collection&lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;Use above mentioned technique (i.e. implementing Comparable) to sort child collections.&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Accounts account;&lt;br /&gt;&lt;span style="color:#6666cc;"&gt;//accounts initialization code&lt;br /&gt;//.....&lt;br /&gt;&lt;/span&gt;List&lt;logins&gt; logins = account.getLoginsCollection();&lt;br /&gt;logins = (List&lt;logins&gt;)Collections.sort(account);&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38911609-2192909525156945140?l=jdev1013.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jdev1013.blogspot.com/feeds/2192909525156945140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38911609&amp;postID=2192909525156945140' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/2192909525156945140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/2192909525156945140'/><link rel='alternate' type='text/html' href='http://jdev1013.blogspot.com/2008/01/toplink-sorting-how-to-all-code-tested.html' title='TOPLINK SORTING: How to'/><author><name>SHAGH'AB</name><uri>http://www.blogger.com/profile/09573969745313606941</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://photos1.blogger.com/x/blogger/3328/425/200/843530/asim-rawal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38911609.post-7210611829889158552</id><published>2008-01-22T16:39:00.001+05:00</published><updated>2008-01-26T19:40:15.599+05:00</updated><title type='text'>Do not Automatically Expose UI components in a Managed Bean</title><content type='html'>I made a JSF page that initially had auto-exposing (of UI components to Managed Bean) disabled -call it Page A. Then I redid with aut-exposing enabled - call it Page B. These were some stats.&lt;br /&gt;&lt;a href="http://bp3.blogger.com/_DmqtXSc0R28/R5XbaiqOE2I/AAAAAAAAAA0/obK4AEP_0_w/s1600-h/ab1.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5158270197249741666" style="CURSOR: hand" alt="" src="http://bp3.blogger.com/_DmqtXSc0R28/R5XbaiqOE2I/AAAAAAAAAA0/obK4AEP_0_w/s400/ab1.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Next comes performance. Page (A) needed around 11 seconds to open up (cold start) in Jdeveloper design view. Page (B) took around 35 seconds. However, both pages took same amount of time while opening in a web browser.&lt;br /&gt;&lt;a href="http://bp1.blogger.com/_DmqtXSc0R28/R5XbyCqOE4I/AAAAAAAAABE/QM_HLsUTHzY/s1600-h/ab2.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5158270600976667522" style="CURSOR: hand" alt="" src="http://bp1.blogger.com/_DmqtXSc0R28/R5XbyCqOE4I/AAAAAAAAABE/QM_HLsUTHzY/s400/ab2.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Conclusion: 44% additional code is maintanence over-head and a lagging designer is productivity killer. So do not use it unless you have a solid reason for it.&lt;br /&gt;&lt;br /&gt;Note (1): All pages were formatted using line length = 127 Character. This has an impact on # of lines.&lt;br /&gt;Note (2): I used Jdeveloper Version 10.1.3.3 on NT 5.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38911609-7210611829889158552?l=jdev1013.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jdev1013.blogspot.com/feeds/7210611829889158552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38911609&amp;postID=7210611829889158552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/7210611829889158552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/7210611829889158552'/><link rel='alternate' type='text/html' href='http://jdev1013.blogspot.com/2008/01/benefits-of-not-using-auto-bind-feature.html' title='Do not Automatically Expose UI components in a Managed Bean'/><author><name>SHAGH'AB</name><uri>http://www.blogger.com/profile/09573969745313606941</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://photos1.blogger.com/x/blogger/3328/425/200/843530/asim-rawal.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_DmqtXSc0R28/R5XbaiqOE2I/AAAAAAAAAA0/obK4AEP_0_w/s72-c/ab1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38911609.post-117598367075027776</id><published>2007-04-08T03:07:00.000+05:00</published><updated>2008-01-26T19:37:03.852+05:00</updated><title type='text'>ADF Faces: Programmatically setting SetActionListener….WHY?</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:10;color:#663366;"&gt;&lt;strong&gt;Question: Because the af:setActionListener component is intended to avoid some managed bean code, is there any particular reason why programming with SetActionListener should be preferred?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:10;"&gt;1) &lt;strong&gt;MORE CONTROL&lt;/strong&gt;: it gives more control...e.g. we can have:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:10;color:#b8cce4;"&gt;&lt;em&gt;&lt;span style="color:#3333ff;"&gt;if(A) EL.set("#{sessionScope.someOtherAttribute}", EL.get("#{sessionScope.someAttribute}"));&lt;br /&gt;&lt;br /&gt;else if (B) EL.set("#{sessionScope.someOtherAttribute}", EL.get("#{sessionScope.someAttribute2}"));&lt;/span&gt;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:10;"&gt;2) &lt;strong&gt;NO CASTING ISSUES&lt;/strong&gt;: There are casting issues with af:SetActionListener when TO field is pointing to primitive data type e.g. boolean (&lt;span style="TEXT-DECORATION: underline"&gt;small b&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;if a variable (e,g, enbaleUpdate) is of type boolean rather Boolean then the following line throws &lt;em&gt;EvaluationException ( IllegalArgumentException: type mismatch&lt;/em&gt;)&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;af:setActionListener to="#{UserStateBean.enableUpdate}" from="true"/&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;font-size:10;"&gt;3) &lt;strong&gt;EASIER TO DEBUG&lt;/strong&gt;: For case like (2) I have found it pretty hard to debug af:SetActionListener component (as compared to code in backing bean)&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38911609-117598367075027776?l=jdev1013.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jdev1013.blogspot.com/feeds/117598367075027776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38911609&amp;postID=117598367075027776' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/117598367075027776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/117598367075027776'/><link rel='alternate' type='text/html' href='http://jdev1013.blogspot.com/2007/04/adf-faces-programmatically-setting.html' title='ADF Faces: Programmatically setting SetActionListener….WHY?'/><author><name>SHAGH'AB</name><uri>http://www.blogger.com/profile/09573969745313606941</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://photos1.blogger.com/x/blogger/3328/425/200/843530/asim-rawal.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38911609.post-117593149076884896</id><published>2007-04-07T12:38:00.000+05:00</published><updated>2007-04-07T12:39:45.846+05:00</updated><title type='text'>Hiding Details if Master doesn’t have any in ADF Faces Tables</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;I had a use case in which some rows in the Master Table can never have any details; so it makes sense to hide details table instead of printing a blank table with some default text message.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I tried to fit in lot of (buggy) logic and then I realized it can be done using simpler way which is:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Let say the child table has &lt;br /&gt;&lt;/p&gt;&lt;p&gt;value="#{bindings.ChildCollection.collectionModel}"&lt;br /&gt;&lt;/p&gt;&lt;p&gt;to hide details add:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;rendered="#{bindings. ChildCollection.estimatedRowCount&amp;gt;0}"&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38911609-117593149076884896?l=jdev1013.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jdev1013.blogspot.com/feeds/117593149076884896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38911609&amp;postID=117593149076884896' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/117593149076884896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38911609/posts/default/117593149076884896'/><link rel='alternate' type='text/html' href='http://jdev1013.blogspot.com/2007/04/hiding-details-if-master-doesnt-have.html' title='Hiding Details if Master doesn’t have any in ADF Faces Tables'/><author><name>SHAGH'AB</name><uri>http://www.blogger.com/profile/09573969745313606941</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://photos1.blogger.com/x/blogger/3328/425/200/843530/asim-rawal.jpg'/></author><thr:total>0</thr:total></entry></feed>
