-
1. Re: polymorphism and rendering
stefanotravelli Feb 3, 2009 5:33 PM (in response to epfreed)I did something similar and I used a sequence of rendered="#{question.type== }", one for each type, so that for a particular type only the right control get rendered.
Validation was not a particular issue with the seam-gen style <s:validate> stuff. It just worked.
-
2. Re: polymorphism and rendering
epfreed Feb 3, 2009 5:51 PM (in response to epfreed)What about casting? Do cast each question to its proper subclass?
If I don't cast, wouldn't there be an EL error? e.g. A multiple choice might have a Set<String> choices that would need to be accessed and iterated ( question.choices ), but a text entry would not have such a field. Wouldn't that cause an error (even it it is not rendered)? Or should I just eliminate the subclasses, and make a big ugly non-abstract Question class?
-
3. Re: polymorphism and rendering
stefanotravelli Feb 3, 2009 6:21 PM (in response to epfreed)I went for the big ugly non-abstract class and type is an enum.
I chosen this approach because I found subclasses over engineered for this purpose.
Thought, I think casting should not be an issue for EL.