Simplica

ProductsLearnPurchaseSupportDemoDownload
  [Search] Search   [Recent Topics] Recent Topics  
RE: Populating a Combobox from a DataModel
Forum Index -> General
Author Message
kuben@itaware.co.za


Joined: 03/26/2009 05:40:00
Messages: 11
Offline

Hi

I would like to be able to populate a Combox with values from a database table. I have tried the following but cannot get the values to appear:

My JSP has:

<e:combobox ajax="true"
editable="true"
labelFieldName="financial_year"
keyFieldName="financial_year"
id="yearCombobox"
labelText="Please select a Year!"
dataModel="#{DataBean.sqlDataModelMasterYear}">
</e:combobox>

My backing bean has the following code:

public SQLDataModel getSqlDataModelMasterYear() {

if (sqlDataModelMasterYear == null) {
sqlDataModelMasterYear = new SQLDataModel();
sqlDataModelMasterYear.setSqlSelect("SELECT financial_year FROM master_year");
}

return sqlDataModelMasterYear;

}

I would also like to find out how to make comboboxes dependant on each other, for example if I select a combobox with months another combobox with the corresponding no. of days must appear.

Thanks
Kuben
adina_mihai
Simplica Team

Joined: 04/01/2007 00:00:00
Messages: 183
Offline

To make combo dependants on each others, you have to do something like this:

<e:combobox id="first" .........
valueChangeListener="#{ComboDataBean.renderCombo}">
</e:combobox>

<e:combobox id="second" .........
rendered="#{ComboDataBean.rendered}">
</e:combobox>

//ComboDataBean
...
private boolean rendered;
//getter and setter
public void renderCombo(ValueChangeEvent evt){
setRendered(true);
}
adina_mihai
Simplica Team

Joined: 04/01/2007 00:00:00
Messages: 183
Offline

About getting sqlDataModelMasterYear, do you have any error in console?
kuben@itaware.co.za


Joined: 03/26/2009 05:40:00
Messages: 11
Offline

Hi

There is no errors in console at all.
It creates the correct number of items in the combobox.
For example the table MASTER_YEAR has five records, and when I click on the combobox it has fives lines, but each value is blank. I can't seem to populate the item values.

Is my code correct?
adina_mihai
Simplica Team

Joined: 04/01/2007 00:00:00
Messages: 183
Offline

Your code is correct. I've send you a patch by email. Delete all your caches before using it. Let me know if it works fine now.
kuben@itaware.co.za


Joined: 03/26/2009 05:40:00
Messages: 11
Offline

Hi Adina

Still does not work.
It now gives me the following error:

java.lang.ClassCastException
simplica.util.base64.Base64 cannot be cast to ResourceBundle

I'm using Glassfish V2 (Sun Java Application Server 9.1) to run it. Can that cause any problems?
adina_mihai
Simplica Team

Joined: 04/01/2007 00:00:00
Messages: 183
Offline

I've sent another .jar. We forgot to remove some files, that's why you got the error. The problem is not related with Sun Application Server/ Glassfish.
kuben@itaware.co.za


Joined: 03/26/2009 05:40:00
Messages: 11
Offline

Hi

Still giving same error as before.

It says possible source of error is:

Class Name: java.util.ResourceBundle$Control
File Name: ResourceBundle.java
Method Name: newBundle
Line Number: 2391

Could you send me a test example that you are using, then I can try it on my side to see whether it gives errors or not.

Thanks
Kuben
adina_mihai
Simplica Team

Joined: 04/01/2007 00:00:00
Messages: 183
Offline

I guess you are using jdk 1.6. Please change it to jdk 1.5, and try once again. It might be a compatibility issue.
adina_mihai
Simplica Team

Joined: 04/01/2007 00:00:00
Messages: 183
Offline

I reproduced and fixed the error with ResourceBundle. I've sent you a new patch file by email.
kuben@itaware.co.za


Joined: 03/26/2009 05:40:00
Messages: 11
Offline

Hi

When I populate my combobox, it has a limit of 50 lines. I am populating the combobox using a sqlDataModel.

Is this a bug?

I am using patch 1.7.20
adina_mihai
Simplica Team

Joined: 04/01/2007 00:00:00
Messages: 183
Offline

Yes, it seems to be a bug. You'll get a patch as soon as it gets fixed.
adina_mihai
Simplica Team

Joined: 04/01/2007 00:00:00
Messages: 183
Offline

I've send you a patch by email.

This fix will be available for everyone starting with ECruiser version 1.1.10 .
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.7 © JForum Team
Home   |  News   |  Contact   |  About   |  License   |  Privacy   |  Documentation
Copyright © 2009 Simplica Corporation. All rights reserved.