Adding to database

hello, i'm a newbie to JSF so am not quite sure what to do!

i'm using mysql and have configured studio creator so they work together.

I'm creating a register/sign up page where the user fills out a few text fields and presses submit. I've read the tutorials but they all seem to have a table in the page or a drop down box blah blah... so i found them a bit confusing and am not sure how to adapt the info to work for my application.

What i'm asking is from filling out the text fields, how do i enter that data into my database?

Thanks.

[573 byte] By [chuck_norris] at [2007-11-26 9:09:15]
# 1

Hi!

here's an example of how you can do it:

String name = (String) nameclass.getValue(); //textfield1

Integer status = (Integer) ddstatusclass.getValue(); //textfield2

try {

RowKey rk = productDataProvider2.appendRow();

productDataProvider2.setCursorRow(rk);

productDataProvider2.setValue("product.product_name",name);

productDataProvider2.setValue("product.status_class",status);

productDataProvider2.commitChanges();

} catch (Exception ex) {

log("Error Description", ex);

error(ex.getMessage());

}

In this case, the table is product and I'm storing the values I got from two text fields, sice the primary key is autoincrement there's no need to specify its value inside the try, because it does it automatically.

Hope it helps =)

Yese

Yesenia at 2007-7-6 23:26:40 > top of Java-index,Development Tools,Java Tools...
# 2
worked like a charm!Thanks :)
chuck_norris at 2007-7-6 23:26:40 > top of Java-index,Development Tools,Java Tools...
# 3
You're welcome =)
Yesenia at 2007-7-6 23:26:40 > top of Java-index,Development Tools,Java Tools...
# 4
So now with JSF, is there no need for any SQL?
chuck_norris at 2007-7-6 23:26:40 > top of Java-index,Development Tools,Java Tools...