• Post Reply Bookmark Topic Watch Topic
  • New Topic

Saving 2 times one form  RSS feed

 
Richard Teran
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone I hope this finds you well

Please help I want something
since I am new to jsf please

:contento:

I would like to help me with an exercise in jsf, I'm trying to do,



I'm trying to save to a table in a database that has only 2 fields, (id, nota),,,

I want to save the data several times just to click on "save" one look

the code that I have is this:






la tabla notas como dije tiene solo 2 campos




I was told to use a foreach or for the insertDatos, but not as used..

Hope you can help me ..
Thank you very much for your attention and your time,,,
:'(
 
Richard Teran
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hope you can help me
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend not to use actionListener. Use "action=" instead. You almost never need to use actionListener and it interferes with portability, reusability and testability. An "action" method is POJO, so it is much cleaner.

Your backing data is not symmetrical. You have defined the View form as a bean "X" containing another bean "X", in effect. More natural would be a single backing bean containing 2 bean "X"s, which could then be accessed as indexed members of an array or list of type bean "X" as a property of your backing bean.

There is no problem with saving 2 or more rows to a database in a single JSF action. It is all in how you organize your data in the backing bean.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!