File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

writing data into sql database

 
Gopu Akraju
Ranch Hand
Posts: 242
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Regards
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
38
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gopu Akraju
Ranch Hand
Posts: 242
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim.
 
Gopu Akraju
Ranch Hand
Posts: 242
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic