haileysdad
asked on
DefaultTableModel
Is there a possibility of using the DefaultTableModel in conjunction with JSF pages? I am trying to add database field to a table in JSF. I don't want to use drop down lists and that seems to be the only info I can find. Any help would be greatly appreciated. I have code to look at if need be.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am trying to implement this code but it keeps telling me that it cannont find symbol.
private void displayResults(List courseList){
Vector<String> tableHeaders = new Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("Course ID");
tableHeaders.add("Course Name");
tableHeaders.add("Section");
tableHeaders.add("Instructor");
for(Object o : courseList){
Courses course = (Courses) o;
Vector<Object> oneRow = new Vector<Object>();
oneRow.add(course.getCourseId());
oneRow.add(course.getCourseName());
oneRow.add(course.getSectionId());
oneRow.add(course.getInstructor());
tableData.add(oneRow);
}//end for
resultsTable.setModel(new DefaultTableModel(tableData, tableHeaders));
}//end displayResults
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
symbol: method setModel(javax.swing.table .DefaultTa bleModel)
location: class com.sun.webui.jsf.componen t.Table
location: class com.sun.webui.jsf.componen
ASKER
I don't want it to use that location, but it seems as if there are no other choices as the design view only provides one type of table.
ASKER
All my imports
import addressBookDB.Courses;
import addressBookDB.HibernateUtil;
import com.sun.data.provider.impl.CachedRowSetDataProvider;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.component.Button;
import com.sun.webui.jsf.component.Label;
import com.sun.webui.jsf.component.Table;
import com.sun.webui.jsf.component.TextField;
import com.sun.webui.jsf.model.DefaultTableDataProvider;
import java.util.List;
import java.util.Vector;
import javax.faces.FacesException;
import javax.swing.table.DefaultTableModel;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so I can't use it where ever I want. Any ideas on how to get may data to the tables using buttons?
i don't siorry, we don't use jsf. All the examples I have seen just dealing with binding tables to databases
ASKER
I've seen plenty of tutorials on using drop down lists, but it is hard to implement them for what I want to do. Oh, well thanks for your time.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER