Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drop down box keeps going back to the first item

 
Jason Richard
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

First off, this is my first post, so hi!
Secondly, if I am posting this in the wrong section, I'm sorry.


Here's my problem. I'm working with a netbeans 5.5.1, jdk 1.5, tomcat 5.5.1.7. I'm not a fan of netbeans so far, but i'm working with a Visual Toolkit.

I have a dropdownlist. The dropdown list is bound to a collectionModel. When the user selects a value from the dropdown list, a table is populated from a differnt collection model. Now, I'm getting the table to change properly without a problem (except on load, but i can fix that). My problem is that the combo box always reverts back to the first item. If i select the third item in the box, I want that item to remain in the box and have the table change.

I've right clicked on the box and selected Auto-Submit on change, which is what i want.

My confusion, is the code here is similar to another page where I do a very similar thing, and that works fine.

Any help would be appricated. I'm sort of flying blind with this JSF/JSP stuff a.t.m.

I've only modified two methods. I populate the Collection Model that the drop down box gets it's data from on my previous page (and it lives in the sessionBean)

public void prerender() {
try {
getSessionBean1().getShelfCollectionModel1().clear();

ItemModel cm = new ItemModel();
cm.setParentItemInstId(Long.parseLong(dropDown1.getValue().toString()));

QueryModel qm = new QueryModel();
qm.addQueryEntry(cm);

getSessionBean1().getItemCollectionModel1().query(qm);


}
catch (Exception e){}

}

public void dropDown1_processValueChange(ValueChangeEvent event)
{
// TODO: Replace with your code
try {
getSessionBean1().getItemCollectionModel1().clear();

ItemModel cm = new ItemModel();
cm.setParentItemInstId(Long.parseLong(dropDown1.getValue().toString()));

QueryModel qm = new QueryModel();
qm.addQueryEntry(cm);

getSessionBean1().getItemCollectionModel1().query(qm);


}
catch (Exception e){}

}
 
Jason Richard
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm.. quiet. IS there more information I should be providing?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic