Sun creator data table issue

I am creating a simple JSF based search application with two pages. First page has a text field and a button. You enter a search keyword and click the button. The second page is now loaded with the information from database into a datatable which matches the search keyword. The datatable is bound to a table where the criteria for the query has to be supplied by the keyword. The issue is I am not able to map the keyword to the cached result set that displays the results. Here is the code in the constructor of Reesults page, I guess this should provide the criteria for the where clause in the query

dataTable1Model.getCachedRowSet().setObject(1, getSessionBean1().getKeyword().toString());

dataTable1Model.getCachedRowSet().execute();

Am I doing it wrong?

Thanks,

Trevor.

[813 byte] By [Trevor_King] at [2007-11-26 10:42:56]
# 1
I think that code is correct. Where do you put that code? Prerender() or init()?Try to put your code in the prerender() in the result page, or put your code in the button_action() in the first page and put nothing in the result page.
discusfish at 2007-7-7 2:54:53 > top of Java-index,Development Tools,Java Tools...
# 2
I tried putting the code in both prerender and the button_action of previous page..No results...The results page still deosnt display anything.
Trevor_King at 2007-7-7 2:54:54 > top of Java-index,Development Tools,Java Tools...
# 3

I assume you have seen the tutorial before. After setting the query criteria, and then cacheRowSet.execute(), the rowset will be filled with the correct data record provided that the supplied value is correct in term of value and type. If the type is incorrect it will throw exception, but if the value is incorrect, it will not be filled with the correct record.

So, I guess, you can inspect the dataProvider (debug and watch), and see if there is any data in its rowset after the rowset.execute(). If there is no data, I guess you might supply wrong value (maybe the length, whatever). Hope that helps.

discusfish at 2007-7-7 2:54:54 > top of Java-index,Development Tools,Java Tools...
# 4
The tutorial mentioned is http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/dat aboundcomponents.html
jetsons at 2007-7-7 2:54:54 > top of Java-index,Development Tools,Java Tools...
# 5

Sorry for the delay in response. I got it done using setCommand() method. I had a deadline and I couldnt spend much time debugging the issue. So I did something like this and it worked.

getSessionBean1().getGrantsdataRowSet().setCommand("My parameterized sql query here");

Thanks for all the responses.

Thanks,

Kingsley

Trevor_King at 2007-7-7 2:54:54 > top of Java-index,Development Tools,Java Tools...