Problem in populating tableview with database data using javafx MVC architecture.

Problem in populating tableview with database data using javafx MVC architecture.

This code is working in simple javafx appliction without MVC architecture. Here i want to populate tableview as it is with database table data. Here the problem is i am getting all elelments of every row in each column of tableview.

Controller:

 @FXML private void handleButtonAction(ActionEvent event) throws Exception
    {
       ObservableList tl = tmd.t_model();
       ObservableList<ObservableList> rl = tmd.t_row();

       for (Object val : tl) 
            {
                TableColumn col = new TableColumn(String.valueOf(val));
                System.out.println("FXMLColumn j[" + (String.valueOf(tl)));

                System.out.println("Column col[" + (String) tl.get(0) + "] ");
                col.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ObservableList, String>, ObservableValue<String>>()
                {
                    public ObservableValue<String> call(TableColumn.CellDataFeatures<ObservableList, String> param)
                    {
                        return new SimpleStringProperty(param.getValue().toString());
                    }

                });
                tableview.getColumns().addAll(col);
            }
         tableview.setItems(rl);
    }    

model;

 public ObservableList t_model() throws Exception
   {
       Connection c ;
            data = FXCollections.observableArrayList();
        try{
                c = Dao.getCon();
                String SQL = "SELECT * from Mem_bill";
                ResultSet rs = c.createStatement().executeQuery(SQL);    

                    for(int i=0 ; i<rs.getMetaData().getColumnCount(); i++)
                    {
                        data.add(rs.getMetaData().getColumnName(i+1));

                    }
                }
            catch(Exception e)
            {
               System.out.println("problem in t_model"+e.getMessage());
            }
                  return data;
   } 
   public ObservableList t_row() throws Exception
   {
       Connection c ;
       ObservableList data1 = FXCollections.observableArrayList();
       c = Dao.getCon();
            String SQL = "SELECT * from Mem_bill";
            ResultSet rs = c.createStatement().executeQuery(SQL);
             while(rs.next())
            {
                ObservableList<String> row = FXCollections.observableArrayList();
                for(int i=1 ; i<=rs.getMetaData().getColumnCount(); i++)
                {
                   String rw=rs.getString(i);
                   row.add(rw);
                   //data1.add(row);
                   System.out.println("ROW BREAK :"+rw);
                   System.out.println("VAL I:"+i);

                }

                data1.add(row);
             }
             return data1;
   }`print("code sample");`
View Answers

July 14, 2014 at 5:06 PM

This is possible in javafx application without MVC architecture. Need help in implementing same in MVC









Related Tutorials/Questions & Answers:
Problem in populating tableview with database data using javafx MVC architecture.
Problem in populating tableview with database data using javafx MVC architecture.  This code is working in simple javafx appliction without MVC architecture. Here i want to populate tableview as it is with database table data
Problem in populating tableview with database data using javafx MVC architecture.
Problem in populating tableview with database data using javafx MVC architecture.  This code is working in simple javafx appliction without MVC architecture. Here i want to populate tableview as it is with database table data
Advertisements
How to display data from database in a TableView
How to display data from database in a TableView  I need to populate a TableView (JavaFx) with database items. I designed the TableView in JavaFx... at this. The classes: This is the Class that creates the database data object: import
populating textbox value from the database using onchange function,
populating textbox value from the database using onchange function,  hi, Everyone I have a problem regarding poulatinng the value in textbox after... dynamically from the database(mysql). after selecting the value from the dropd
using jsp and servlets andin Mvc architecture
using jsp and servlets andin Mvc architecture  how to insert a form data in different tables, that means education details in education table, address details in address table,like that and finally if we fetch all must come
online book store by using MVC architecture
online book store by using MVC architecture  Tarzan book store... and servlets The application needs to be built in J2EE and complaint with MVC architecture. (adsbygoogle = window.adsbygoogle || []).push
Problem insert data into database using servlet n javabean - Java Beginners
Problem insert data into database using servlet n javabean  I created a servlet for registration proses I got a problem compiling my servlet.. (incompatible type: int and required: java.lang.ResultSet) can anyone help me
How to display data from database in a TableView via Hibernate
How to display data from database in a TableView via Hibernate  I need to populate a TableView (JavaFx) with database items. I designed the TableView in JavaFx Scene Builder. So far the TableView does not change at all and only
Query for generating Stock Report Using MVC architecture in j2ee
Query for generating Stock Report Using MVC architecture in j2ee  ... some data (current stock=(summation of)watch Quantity in WATCHMASTER... tables with data is: WATCHMASTER { watchid varchar(30), watchname varchar(20
mvc architecture - Java Beginners
mvc architecture  i am asking you give me an example for the object oriented programming using MVC architecture then my problem is railway tickect... to that arraylist. for this one i have to do code in MVC architecture
mvc architecture - Java Beginners
mvc architecture  can u please provide a example program with code using mvc architecture mine problem is adding routes for the railwaystation... on the MVC architecture please send me the link for knowing the implementation code
MVC Architecture
MVC Architecture      .... They are expressive: By using the MVC design pattern our application becomes more... between page and model as data access is usually done using Custom tag
Problem in accessing data from Database
Problem in accessing data from Database  hi..... i'm making a project on servlet and jsp with ms access 2007 at the backend. One field in my database... in currency column and then try to retrieve data using my servlet coding
MVC Architecture In Java
using design pattern. Model 2 (MVC) Architecture : Applications... architecture. These are as : Using the MVC architecture we can make our...MVC Architecture In Java In this section we will discuss about the MVC
insert data in the database using checkbox
insert data in the database using checkbox  i am fetching data from the database using servlet on the jsp page and there is checkbox corresponding each row but the problem is that i am not fetching data in any textboxes so how
How to save database data into excelsheet using hibernate
How to save database data into excelsheet using hibernate  How to save database data into excelsheet using hibernate
How to insert and retreive an image in mysql database using spring mvc framework???
How to insert and retreive an image in mysql database using spring mvc framework???  I ve solved this problem based on the Product Search Application. Those who need this concept and code segment kindly copy it. Thanks and All
Spring MVC and Hibernate with DWR 3 -- Configuration Using MySQL Database
Spring MVC and Hibernate with DWR 3 -- Configuration Using MySQL Database  How to configure Spring MVC and Hibernate with DWR 3, Simple example -- reading a table, editing-deleting and adding new rows
MVC architecture example - Java Beginners
MVC architecture example  hi.. I would like to ask the example on Login authentication using MVC model. I really don't understand how it work. Can...+Database related to MVC model.. Really need your help.. Please.. ASAP.. 
retrieve data from database using jsf
retrieve data from database using jsf  Hello I want an example of source code to retrieve data from database i have a database (oracle) name as db1 it's contain table 'author' composed of three columns idauthor(primary key
how to insert data into database using jsp & retrive
how to insert data into database using jsp & retrive  Hello, I have created 1 html page which contain username, password & submit button. in my oracle10G database already contain table name admin which has name, password
save multiple records into database using jsp/servlet mvc
save multiple records into database using jsp/servlet mvc  hai... it to database in single hit user.jsp <form action="UserServlet" method="post... set to bean and pass bean to dao insert() and insert into database thank u
Upload Image and save in database using jsp-servlet mvc
Upload Image and save in database using jsp-servlet mvc  Here is my code.. In jsp ... <form name=frm method="post" action="Device"> <table> <tr><TD ><B>Upload Image</B><
Upload Image and save in database using jsp-servlet mvc
Upload Image and save in database using jsp-servlet mvc  Here is my code.. In jsp ... <form name=frm method="post" action="Device"> <table> <tr><TD ><B>Upload Image</B><
problem in database
problem in database   thanks for web site. I want change this code to insert data into PostgreSql database using jsp,servlets. but i getting output "Record has been inserted", 1.no data in the table(sample) public
populating text box using jsp code
populating text box using jsp code  Sir, How to populate related values in a text box after selecting value from drop down list using JSP and mysql. I tried using Ajax from your example. But for some browser it does not support
how to insert data in database using html+jsp
how to insert data in database using html+jsp  anyone know what... and database name. Here machine name id localhost and database name..."; // declare a connection by using Connection interface
database problem
database problem  I did connect my jsp page to database and it showed the result on another jsp page but i want to show the data of that field on which i click to mouse from the jsp page where all the data field has been showed
database problem
database problem  I did connect my jsp page to database and it showed the result on another jsp page but i want to show the data of that field on which i click to mouse from the jsp page where all the data field has been showed
Populate a combo box using data from a database
Populate a combo box using data from a database  Hi Guys, In need... to populate the first one, and then how to send the data off to a servlet and preform a search on the database for the values I want, but then how do I pass that back
problem from registering a data in database with servlet - JSP-Servlet
problem from registering a data in database with servlet  Hi Rose, i created a servlet to validates ten user details in the database, if present... the user's details and submit into database. but it'll first insert the details
retrive data from database using jsp in struts?
retrive data from database using jsp in struts?   *search.jsp* <%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
How to get the data from the database using Servlet or JSP program
the problem   Get data from database using servlet Retrieve data from database using JSP Get data from database using JSP...How to get the data from the database using Servlet or JSP program  
a complete project on spring web mvc using oracle database in netbeans ide 7.0
a complete project on spring web mvc using oracle database in netbeans ide 7.0  dear sir , i want a complete tutorial on the title matter.please sir help me . any full developped project based on shopping cart can
About MVC 2 architecture and jsp - JSP-Servlet
About MVC 2 architecture and jsp  Sir, I want to know about MVC 2 architecture and can we bring all functionalities of servlets in jsp.What is the need of servlets when jsp can perform all functionalities .  Hi
sending data to google chart api from mysql database using java
sending data to google chart api from mysql database using java  how to send data from mysql database to google chart api using java
i need program to insert data in database using javascript
i need program to insert data in database using javascript  please help me
Read data from excel file and update database using jsp
Read data from excel file and update database using jsp  read data from excel file and update database using jsp Hi, I am using a MySQL database... upload excel file and update database using JSP ? Thanks in Advance
view data from database using drop down list
view data from database using drop down list  hi i want to view the data from database by selecting a value in a drop down list. for an example drop down list have picture element.when click it select pictures from the database
How to get data from Oracle database using JSP
How to get data from Oracle database using JSP  hello i have a simple problem in jsp in the sense to get data from the database like oracle . I have... the answer to retrieve data from the database by using servlet or jsp program
problem in inserting data in databases created in netbeans using jsp..
problem in inserting data in databases created in netbeans using jsp..  i am trying to make a virtual classroom website in jsp using netbeans.i...+")"); out.println("Data is successfully inserted!"); } catch(Exception e
place data in text fields from database using jdbc
place data in text fields from database using jdbc  i want get the data from database and place the records in the respective textfields using jdbc and swing like eno,ename,loc from emp table
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
problem in inserting data in databases created in ecplise using jsp
problem in inserting data in databases created in ecplise using jsp  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import="java.sql.*" %> JS Soft
problem in inserting data in databases created in ecplise using jsp
problem in inserting data in databases created in ecplise using jsp  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import="java.sql.*" %> JS Soft
using ajax i want to insert data into oracle database
using ajax i want to insert data into oracle database  i would like to insert/update/select/delete from jsp to oracle database using ajax? please send a code for this iam using oracl database thank you
retrieve related data from database using jsp and mysql
retrieve related data from database using jsp and mysql  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must
Data needs to be gathered in XML file from the database (MySql) using JSP
Data needs to be gathered in XML file from the database (MySql) using JSP ... data regarding particular id from the database table. Data needs to be gathered in XML file from the database (MySql) using appropriate JSP/Java Bean functions
populating one dropdown box depending on the value of other using jsp
populating one dropdown box depending on the value of other using jsp  HI i have scenario i need to populating one dropdown box depending on the value of other using the below table country name state and city name should load
how read excel data into database using struts2 with hibernate
how read excel data into database using struts2 with hibernate   hi friends, i am venkat i am started learning struts 2, please help me how to read excel data into database using struts2 with hibernate, please show me

Ads