wood burning stoves 2.0
The moose likes JSF and the fly likes writing data into sql database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "writing data into sql database " Watch "writing data into sql database " New topic

writing data into sql database

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242

I have managed to get the information from the through beans in a jsf page1 and displaying them succeffully in the next page2 after clicking on a button page1.

Now my next objective is to write those details into a sql database. How do I proceed?
In the first page when the user clicks the button, then all the info should be written into a sql table. Please guide me. Thanks.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

When the user clicks a JSF commandButton or commandLink, the backing bean's action method is invoked (after all the form properties, if any have been set). This is where you'd put the logic that writes the data to the database.

Exactly how to write to the database - basic JDBC, an ORM framework such as Hibernate, or whatever - is up to you.

An IDE is no substitute for an Intelligent Developer.
Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
Thanks Tim.
Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
I van write a method inside java class to update the database. But where do I store tha database details? I tried as below. But I get some error in web.xml file.

web.xml as below:

I created context.xml to store the details of database as below:

I am following an example from web to apply into my application. Hence something is missing which I am nto aware. I get error as "Invalid content was found starting with the element <resoure-ref>.

My web.xml is as below:

Can anyone tell me how to proceed further? Thanks.
I agree. Here's the link: http://aspose.com/file-tools
subject: writing data into sql database
It's not a secret anymore!