Hello,
I have a best-practice-question for following requirement:
Imagine, your JSF application has to be devided in 3 main tabs. The business logic of the 3 pages is almost the same, the GUI Layout differs a bit, each tab "has its own state", which must not be lost when changing the tabs.
Example:
The GUI consists of 3 three tabs, each displaying soccer results:
Premiere League, Serie A, Primera Division
The page showResults.xhtml is responsible for displaying the results.
The ManagedBean SoccerBean holds the data of the soccer results.
Problem: I want to avoid redundancies. But:
I have to [b]duplicate[/b] showResults.xhtml
because each page must reference its own ManagedBean instance to preserve its own state:
showResultsPremiereLeague.xhtml --> uses #{soccerBeanPremiereLeague} of type PrimierLeagueSoccerBean
showResultsSerieA.xhtml --> uses #{soccerBeanSerieA} of type SeriaASoccerBean
showResultsPrimeraDivision.xhtml --> uses #{soccerBeanPrimeraDivision} of type PrimeraDivisionSoccerBean
OK, regarding the managed bean, you can create a PrimeraDivisionSoccerBean SeriaASoccerBean PrimierLeagueSoccerBean to have soccer league specific business logic.
But the problem is, that I have many redundancies when I want to access the managed bean via EL (for example in xhtml pages, converters, other managed beans).
What is best practice for this case?
Implementing a custom EL resolver, which can resolve #{soccerBean} to the wanted bean (in this case the el resolver needs to know the current active tab) so that in the PremierLeague #{soccerBean} can resolve to #{soccerBeanPremiereLeague} ?
[Message sent by forum member 'donkon']
http://forums.java.net/jive/thread.jspa?messageID=469521