Need help getting DataProvider cursor methods to work in JSC
Hi, I'm a newbie to Creator as well as JSF. I'm using JSC Update 1. I've
worked through a couple of the beginning tutorials including "Performing
Inserts, Updates, and Deletes" without a problem. I'm now trying to
craft a simple jsf database form application on my own using the sample
travel database and I'm stuck!
I put text fields on the form corresponding to each of the 4 fields in
the PERSON table and bound them to the fields in the table which, on
examination, resulted in a CachedRowSetDataProvider (personDataProvider)
in Page1 and a CachedRowSetXImpl (personRowSet) in SessionBean1. I then put 4 buttons on the form (First, Previous, Next, Last) for record
navigation. Here is the code I put in the first two actions (the others are
the same except for the cursor methods):
public String btn_firstrec_action() {
try {
personDataProvider.cursorFirst();
} catch (Exception e){
error("cursorFirst failed: " + e.getMessage());
log("cursorFirst failed " , e);
}
return null;
}
public String btn_next_action() {
try {
personDataProvider.cursorNext();
} catch (Exception e){
error("cursorNext failed: "+ e.getMessage() );
log("cursorNext failed " , e);
}
return null;
}
etc.
When I run the application using the bundled app server I get strange
behavior when I click the navigation buttons. There are 6 records in the
table. The application opens up displaying the data for the first
record. Clicking "Next" takes me to record 2--so far so good. However,
with repeated clicks on "Next", "Previous", "First" the data displayed in
the form remains the same. If I click "Last" (personDataProvider.cursorLast(); ), the data from record 6 is rendered OK!
I worked a little in the debugger. I added a cursorChanging method and
put a break point in there. Then I watched the index attributes for rk1
an rk2 as I continued the execution. I had to hit Alt+F5 (Continue)
2 to 4 times on each button click depending on the action--4X
with "Next" and "Previous". For each button click the index values would
change at first to what logically seemed the correct values but
then snap back to 0 or 1 as I kept continuing depending on the sequence--
wierd to me.
I also tried configuring all the form fields in a virtual form with
"Participate" on for the text fields and "Submit" on for the buttons
with the same result (I was really "shooting in the dark" here!).
I'm obviously missing something here--this shouldn't be this difficult!
I have scanned through a lot of the excellent tutorials, articles and forum posts as well as some of the sample apps but haven't as yet found a similar example of using the DataProvider cursor methods which seems pretty basic to me but, I could have easily missed seeing what I needed.
Any help would be greatly appreciated--I'm really counting on this tool
to get an overdue project going so I'm somewhat desperate.
Thanks, Len Sisson

