• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic forms in jsf

 
Thierry Collogne
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

This question has probably been asked a thousand times, but I can't find the answer.

I am an experienced Struts developer, but now I want to create an application using jsf.

It will be some kind of quiz with multiple choice questions. The problem is that the number of questions is not fixed, so for 1 quiz there can be 10 questions and for another one 20.

In struts I know that there is something called map-backed action forms that can be used for this kind of thing.

Does jsf have something like this? I can't seem to figure it out.

Thank you.
 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could use a dataTable (that maps to a java.util.List on the backing bean), you can add/delete elements to the List in your backing bean based upon the number of questions.
 
Thierry Collogne
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. I will take a look into it. But will it work with the following structure?
Say the quiz consists of multiple choice questions. So I am thinking of creating the following structure of beans.

The java.util.List will contain a number of "Question" beans. Each one of these "Question" beans will contain an list of "Answer" beans (this are the possible answers to choose from).

Can this be done with a dataTable? Does anyone know a link to good example of a dataTable?

Thank you
[ September 25, 2006: Message edited by: Thierry Collogne ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!