I'm new to JSF so sorry if my question is trivial.
I have to present a list of items of three different types: let's say books, software and courses with different metadata (attributes) and requiring different visual representation.
Each of these items inherits from an abstract Item class, so I've a list of Items.
I thought to declare an abstract method getHtml()
in the Item class so that each subclass can implement it's own "renderer" . Then in the XHTML page I'll call the getHtml()
method using EL.
The question is: is this the correct way?
I see some drawbacks:
- model mixed with view
- HTML generated by means of Java code (quite difficult to maintain).
Any suggestion is appreciated.
I don't know if this synthetic presentation is clear enough: in case, please ask for clarifications.
Thanks in advance.