Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Problem in populating tableview with database data using javafx MVC architecture.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Monika Boriwar
Problem in populating tableview with database data using javafx MVC architecture.
1 Answer(s)      3 months and 14 days ago
Posted in : Java Beginners


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");`

Advertisement
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
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
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
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
online book store by using MVC architecture
online book store by using MVC architecture  Tarzan book store decided to go online to increase itsā?? revenues and provide itsā?? customers a way... and complaint with MVC architecture
MVC Architecture
MVC Architecture      ...: By using the MVC design pattern our application becomes more expressive. 1). ... as data access is usually done using Custom tag or through java bean call
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
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 In Java
2 (MVC) Architecture : Applications are developed using MVC (Model-View.... These are as : Using the MVC architecture we can make our application loosely...MVC Architecture In Java In this section we will discuss about the MVC
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
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 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.. 
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
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
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
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
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
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><
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
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
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
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
Jsp using mvc - JSP-Servlet
Jsp using mvc  hi I have written using mvc2 architecture, i have... the data that need to be displayed. It is model who is aware about all the operations that can be applied to transform that object. It only represents the data
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
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
 

 

 

DMCA.com