Need help with the Jdeveloper classes to create a search hitlist (BC4J, jsp) - JDeveloper and ADF

I need to create a search page and a results page. The results page would need to show only 25 records at a time(per page). There would be the need for a "Next", "Previous", "First" and "Last" hyperlink navigating to the next 25 records, previous 25 records, etc.
I can create the search page. The problem I am having is trying to use the JDev classes to present 25 records per page. I assume I would have to create a rowset from the datasource, etc. but I can't get it to work.
Can someone give me some direction about how to create a search results page programatically as opposed to the pre-built datatag wizard which scrolls through every record in the datasource.
TIA.

Related

Displaying results from a database query using servlets

I have this HTML form where users can search a MS Access database by entering a combination of EmployeeID, First name or last name. This form invokes a Java Servlet which searches the database and displays the results as an HTML page. I am giving the user the choice of displaying 3, 5 or 10 results per page. I want to know how to do that using servlets. If a particular search results in 20 results, the results should be displayed in sets of 3, 5 or 10 depending on the user's choice. If the user makes a choice of 5 results per page then 4 pages should be displayed with a "next" and "previous" button on each page. I want to know how this can be done. 
see http://jsptags.com/tags/navigation/pager/index.jsp 
Arun,
I'm not sure how to do this using JSP as I have not worked on JSP.
But I can give you a hint on how to do this within normal java class as I've used this in my current project.
In your core class/bean that generates the entire resultset, you need to run a loop that will scan through the desired number of records in the resultset.
To do this, you have to have skip and max parameter in your URL.
Somthing like http://server.com/myservlet?skip=0&max=10 to display first 10 records, http://server.com/myservlet?skip=10&max=10 to display next 10 records. The <next>parameter would be fed in by the user by a simple form in your web-page. If you need to hold this <max-num-of-recs-per-page> param, you can store it in a cookie (since this is nothing crucial piece of info, don't need to use session obj etc...cookie will do) and get the value each time you display the resultset.
So, essentially, suppose you are at the first page and you wish to show 10 recs at a time. The link for "Next" button would be http://server.com/myservlet?skip=10&max=10
when at the second page, you'll have
"priv" button as http://server.com/myservlet?skip=0&max=10 and
"next" button as http://server.com/myservlet?skip=20&max=10 and so on...
hope this makes sense..
Shantanu

Dividing a table data in multiple forms...

Hi,
We want to divide a table columns into 2 pages i.e., We've a table of 20 columns. We need to divide these table columns into two pages. The first page will have some drop downs which decides the fields in next page. In this first page on selecting some dropdown should fill up other drop down picking the data from DB based on a Query with Where condition. In the first page we should have NEXT and RESET buttons. In the second page we should have SAVE, CANCEL, RESET etc buttons.
The problems I'm facing are
1) For refreshing drop down data based on the selection, I've written a query on SELF submit (Unconditional Branch). Now how to implement NEXT and RESET functionalities? (These should use conditional branches??? Am I correct).
2) Can we write our custom insert statements while saving.. If so how to bring data from multiple pages?
3) How do we put the required field information in SESSION or APPLICATION scope as we do in .NET or JAVA?
Help me out guys...
Thanks in advance for any help,
Regards, NKUMAR 
Hi Nkumar
Apex is much simpler than other tools in the sense that there is not notion (AFAIK) of "scope". After a page item is initialized, it can be accessed by any page in the application. In other words, all page items are session level. That is why the default item names have the page ID on them, like P1_NAME, to differentiate from items in other pages.
There are "application level" items, which despite the name are session level too; the main difference being that they are created when the application starts and are not linked to any specific page, and are visible only to the current session.
I don't think that are actual application level items, and I don't know how to implement them if I needed (anyone?)
So, in your case, in the page process that will insert the data in page 2, you just have to reference the items in page 1 without having to do anything else. You can create a process conditioned to a button that inserts data using items from both pages.
For the NEXT button, I think it is enough to assign a branch to page 2 to the respective button, if I understood well what you need to do.
For the RESET button, I think it is enough to assign a branch to the same page to the button, but indicate that you want to reset the page items.
I hope this helps.
Luis

An Edit page: I always see the same data.

Hello,
I'm learning ADF.
I have a problem with a very small web application I'm trying to develop. I have 2 pages, an overview page and an edit page.
The overview page has a ADF read-only table which is based on a view on 1 table which has only 2 records. The table has an edit button and every row has a radio button, so I can choose a row, press the edit button and go to a detail page (the edit page) where I can change the data.
To make these pages I've followed the steps in this tutorial http://www.oracle.com/technology/obe/obe1013jdev/masterdetail_adf_bc/master-detail_pagewith_adf_bc.htm#t7.
The problem is that no matter which row I choose in the overview page, I always see data of the first record in the edit page.
I've been through the steps in "Synchronizing the pages" of the tutorial twice, but can't find a step I missed or did different. Besides that I think it could have to do something with the Iterator I'm practically clueless.
So, anyone who perhaps knows what I could have done wrong ? 
Right, found it :-).
On the edit page I used a different view than on the overview page.

Noob Q: taking values with you from page to page

I want to make a wizard where the user selects/enters values on each page and then klicks a next button to get to the next page.
The input will be different on each page, a selectlist on one and a shuttlebox on another and a textfield on a third and so on
On each page I want a textregion that list the values that have been selected/entered on the previous pages.
So I want one value with me when i jump from page 1 to page 2, two values with me when I jump from page 2 to page 3 and so on. On the final page I need to construct an SQL query (update table) based on the collected values.
I've used the built in wizard template with a textfield to present the choices made along the way but how do I get them from page to page?
Any help appreciated 
How about using the apex collection API to temporarily store your values...
http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/advnc.htm#BABFFJJJ
Yopu can then use your collection to construct your (update table) based on the collected values

refreshing records in jsp uix jdev9i

I have a project where when you first bring up my customer.jsp it diplays the first 4 records and lets me pick other records in groups of 4. If I do a specific search and bring up one customer and then move to other jsp pages to get the phone info, etc. When I return to my origional customer.jsp page, it still displays the last customer i searched on. How do I get the customer.jsp page to show my groups of 4 everytime I return to it??
Any help or suggestions would be great, thanks 
The search changes the WHERE clause of the view object your are using to display your results. In order to clear out the search, you need to clear any search criteria you have setup. This should be the same as running the search page without any criteria.

Categories

Resources