Hi guys,
i've a very important question for you,i'm stopped my work from 10 days to solve it,but nothing....
i hope your can help me.
I'm developing a jsf application and i've created a datatable with empty fields, so each row of my datatable is an input row...i've associated a button to each row and cliccking them i retrieve values inserted by user(for each row) and i put them into a database.
What i want now is avoiding to use a button for each row,i want one only button at the end of page that send to database the data inserted in each row.
I've started - public void SendData(ActionEvent e){
-
System.out.println("inizio vedi riga");
-
List values=(List) (getBiosampleDataTable()).getValue();
-
System.out.println("La dimensione è "+values.size());
-
for (int j=0;j<values.size();j++){
-
-
Object obj=values.get(j);
-
System.out.println(((Biosample) obj).getOrganism());
-
-
-
//System.out.println((String) biosampleItem.getLabel());
-
-
}
-
-
}
that is,
with - List values=(List) (getBiosampleDataTable()).getValue();
i retrieve values of datatable into a list called values.
With - Object obj=values.get(j);
i try to read a single row into an object
and with - System.out.println(((Biosample) obj).getOrganism());
i try to print the organism value for row i.
Biosample is type of managed bean used to wrapp the single row.
My question is:
Each value i retrieve is NULL!!!!!
Why?
Please help me,it's my first post....
5 5035
Hi guys,
i've a very important question for you,i'm stopped my work from 10 days to solve it,but nothing....
i hope your can help me.
I'm developing a jsf application and i've created a datatable with empty fields, so each row of my datatable is an input row...i've associated a button to each row and cliccking them i retrieve values inserted by user(for each row) and i put them into a database.
What i want now is avoiding to use a button for each row,i want one only button at the end of page that send to database the data inserted in each row.
I've started - public void SendData(ActionEvent e){
-
System.out.println("inizio vedi riga");
-
List values=(List) (getBiosampleDataTable()).getValue();
-
System.out.println("La dimensione è "+values.size());
-
for (int j=0;j<values.size();j++){
-
-
Object obj=values.get(j);
-
System.out.println(((Biosample) obj).getOrganism());
-
-
-
//System.out.println((String) biosampleItem.getLabel());
-
-
}
-
-
}
that is,
with - List values=(List) (getBiosampleDataTable()).getValue();
i retrieve values of datatable into a list called values.
With - Object obj=values.get(j);
i try to read a single row into an object
and with - System.out.println(((Biosample) obj).getOrganism());
i try to print the organism value for row i.
Biosample is type of managed bean used to wrapp the single row.
My question is:
Each value i retrieve is NULL!!!!!
Why?
Please help me,it's my first post....
Is there any data in the database?
what is the method SendData supposed to do and why does it take an ActionEvent if does not use it?
my datatable is generated by a list with empty values(the user has to fill its fields).
I want the method send data takes data inserted by user in the rows...
that is,the user see a datatable with many input forms(empty).
The user fill each row of the datatable,click sendData button and the values now inserted go into db...
is it possible?
With my method i retrieve only null values(as i don't retrieve inserted values,but the initial values of datatable...).
I've used actionListener to have not navigation to another page,but result don't change with action...
With my old method i've associated a command button to each row,i clicked on it and datatable row inserted go into db.
What i want know is avoiding those command button for each row,and create an only function that does it for each row...is it possible?
This is my working old method - public void editBiosample(ActionEvent event) throws SQLException {
-
-
-
setBiosampleItem((Biosample) getBiosampleDataTable().getRowData());
-
int index=getBiosampleDataTable().getRowIndex();
-
-
if (conn != null) {
-
Experiment exp = (Experiment) ViewUtils
-
.eval("#{experiment}");
-
PreparedStatement pst3 = null;
-
-
chiave=exp.getAutoKey();
-
pst3 = conn
-
.prepareStatement("INSERT INTO campione(id_campione,id_,organismo,protocollotrattamento,metodoestrazione,tipoamplificazione,protocolloibridazione,protocollomarcatura) VALUES(null,?,?,?,?,?,?,?)");
-
-
pst3.setInt(1, getChiave()+1);//per mantenere la coerenza con la transazione,l'id massimo della tabella precedente non è stato ancora incrementato!!
-
pst3.setString(2, getBiosampleItem().getOrganism());
-
pst3.setString(3, getBiosampleItem().getTreatmentProtocol());
-
pst3.setString(4, getBiosampleItem().getExtractionMethod());
-
pst3.setString(5, getBiosampleItem().getAmplification());
-
pst3.setString(6, getBiosampleItem().getHybridation());
-
pst3.setString(7, getBiosampleItem().getLabel());
Excuse my poor english and jsf experience...
my datatable is generated by a list with empty values(the user has to fill its fields).
I want the method send data takes data inserted by user in the rows...
that is,the user see a datatable with many input forms(empty).
The user fill each row of the datatable,click sendData button and the values now inserted go into db...
is it possible?
With my method i retrieve only null values(as i don't retrieve inserted values,but the initial values of datatable...).
I've used actionListener to have not navigation to another page,but result don't change with action...
With my old method i've associated a command button to each row,i clicked on it and datatable row inserted go into db.
What i want know is avoiding those command button for each row,and create an only function that does it for each row...is it possible?
This is my working old method - public void editBiosample(ActionEvent event) throws SQLException {
-
-
-
setBiosampleItem((Biosample) getBiosampleDataTable().getRowData());
-
int index=getBiosampleDataTable().getRowIndex();
-
-
if (conn != null) {
-
Experiment exp = (Experiment) ViewUtils
-
.eval("#{experiment}");
-
PreparedStatement pst3 = null;
-
-
chiave=exp.getAutoKey();
-
pst3 = conn
-
.prepareStatement("INSERT INTO campione(id_campione,id_,organismo,protocollotrattamento,metodoestrazione,tipoamplificazione,protocolloibridazione,protocollomarcatura) VALUES(null,?,?,?,?,?,?,?)");
-
-
pst3.setInt(1, getChiave()+1);//per mantenere la coerenza con la transazione,l'id massimo della tabella precedente non è stato ancora incrementato!!
-
pst3.setString(2, getBiosampleItem().getOrganism());
-
pst3.setString(3, getBiosampleItem().getTreatmentProtocol());
-
pst3.setString(4, getBiosampleItem().getExtractionMethod());
-
pst3.setString(5, getBiosampleItem().getAmplification());
-
pst3.setString(6, getBiosampleItem().getHybridation());
-
pst3.setString(7, getBiosampleItem().getLabel());
Excuse my poor english and jsf experience...
should be possible. you'd need to name the inputs cleverly so that you'd use them in a loop. Are you using JTextFields or HTML form inputs?
You could also use JTable
Thanks for you reply but i've not understood very well....
i use this to insert data -
<h:column>
-
<f:facet name="header">
-
<h:outputText value="#{msg.IdBiosample}" styleClass="outputText"/>
-
</f:facet>
-
<h:outputText value="Campione#{biosampleItem.id}" />
-
</h:column>
-
-
-
<h:column >
-
<f:facet name="header">
-
<h:outputText value="#{msg.Organism}" styleClass="outputText"/>
-
</f:facet>
-
<h:selectOneMenu value="#{biosampleItem.organism}">
-
<f:selectItems value="#{getDropList.selectOrganism}"/>
-
-
</h:selectOneMenu>
-
</h:column>
-
-
<h:column>
-
<f:facet name="header">
-
<h:outputText value="#{msg.Treatment}" styleClass="outputText"/>
-
</f:facet>
-
<h:inputText value="#{biosampleItem.treatmentProtocol}" styleClass="inputText"/>
-
</h:column>
-
-
what code i need to solve my problem?
Thanks very much,i hope you help me,you are my last hope....
Help me with easy code,please....i'm a newbie
Thanks for you reply but i've not understood very well....
i use this to insert data -
<h:column>
-
<f:facet name="header">
-
<h:outputText value="#{msg.IdBiosample}" styleClass="outputText"/>
-
</f:facet>
-
<h:outputText value="Campione#{biosampleItem.id}" />
-
</h:column>
-
-
-
<h:column >
-
<f:facet name="header">
-
<h:outputText value="#{msg.Organism}" styleClass="outputText"/>
-
</f:facet>
-
<h:selectOneMenu value="#{biosampleItem.organism}">
-
<f:selectItems value="#{getDropList.selectOrganism}"/>
-
-
</h:selectOneMenu>
-
</h:column>
-
-
<h:column>
-
<f:facet name="header">
-
<h:outputText value="#{msg.Treatment}" styleClass="outputText"/>
-
</f:facet>
-
<h:inputText value="#{biosampleItem.treatmentProtocol}" styleClass="inputText"/>
-
</h:column>
-
-
what code i need to solve my problem?
Thanks very much,i hope you help me,you are my last hope....
Help me with easy code,please....i'm a newbie
Sorry my friend but that's just as much I could contribute. You see I'm also new jsf. I only work with servlets, jsps and ejbs. I hope someone else will be able to help you. This java forum is usually quiet though. If you don't get help soon enough, you might have to try (I don't like doing this but ...) sun Sign in to post your reply or Sign up for a free account.
Similar topics
by: anon |
last post by:
I have a datatable of values and I am trying to obtain the values of a range
of the columns.
Imagine I have a table defined with columns headed "A" through to "Z"
Now I decide that I want to...
|
by: tangus via DotNetMonster.com |
last post by:
Hello all, I'm really struggling with getting some Active Directory code to
work in ASP.NET. Can you please provide assistance? I am executing the
following code:
Dim enTry As DirectoryEntry =...
|
by: Dylan Parry |
last post by:
Hi,
At the moment I use code like the following:
string myString = this.dataReader.IsDBNull(2) ? null :
this.dataReader.GetString(2);
With a record from the DB that looks like:
...
|
by: AlveenX |
last post by:
Hi,
I am trying to pick a Guid from a data row using the following code:
foreach(DataRow row in MyDataTable.Rows)
{
(Guid)row
}
|
by: funky4you |
last post by:
I am using a simple select query in C# app that fetches a row which has a datatime field.
The query is simple "SELECT * FROM THE USERS WHERE USER_NAME = 'ABC' ",
the users table contains a...
|
by: Olaf Rabbachin |
last post by:
Hi folks,
I'm looking for a way of retrieving the default-value of a table's field
within an Access 2003 MDB.
Any hints on how to accomplish this from ASP.Net?
Thanks,
Olaf
--
My .02:...
|
by: Chris |
last post by:
Hi,
I'm using the following code
DataTable tables = ((OleDbConnection)oleconn).GetOleDbSchemaTable(
OleDbSchemaGuid.Tables, new object { null, null, null,
"TABLE" });
foreach (DataRow r in...
|
by: Phijo |
last post by:
Hello, I'm a Java developer but brand new to ASP (i have done some of the tutorials) so I have some ASP programming background however I cannot find the cause or the fix to this problem.
I am...
|
by: preethadotnet |
last post by:
Hi,
Can anyone tell me how to retrieve record values from a datatable?.My requirement is like:
Within a for loop I am executing different stored procedures and storing records in a datatable...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |