I am working on a web application using Woodstock component. In short, if the dropdown value equals to "PRIMARY KEY", the function should store the name of the table (from the textfield) into the String pk/primaryKey.
The problem I am facing currently is that the results obtained from the function is:
"abc"
instead of
"a, b, c"
Why is this happening?
public void addPK(TextField tf, DropDown dd, StringBuilder pk, int val) {
if (((String) dd.getValue()).equals("PRIMARY KEY")) {
if (val == 0) {
pk.append((String) tf.getValue());
val++;
} else {
pk.append(", " + (String) tf.getValue());
}
}
}
public String createButton1_action() {
StringBuilder primaryKey = new StringBuilder();
int pkCheck = 0;
addPK(column_TF1, pkDropDown1, primaryKey, pkCheck);
addPK(column_TF2, pkDropDown2, primaryKey, pkCheck);
addPK(column_TF3, pkDropDown3, primaryKey, pkCheck);
.
.
}
Thank you.