We have a huge (many different views) Java EE application whose web layer transmit DHTML content to the browser to generate the current view.
We use a custom Javascript AJAX framework to manage standardized component events on the view.The framework is loaded by an initial page template that will host all the fallowing different views.
We built a tool for "non programmers" which is used to define a web view in terms of layout, events and related functions. Once the view is defined, DHTML is programmatically created and stored in the database.
The user request (AJAX) for a view is handled by an action object that extracts the DHTML content from DB and sends it to the browser, where will be rendered inside the template or a modal window.
For various reasons we are planning to get rid of the Javascript framework and move the view event management to the server side.
Looking for a feasible Java framework, we studied JSF that seams to have all features we need, except the one to create the view on the fly as described before.
Did we miss some JSF feature or workaround?
If not, are you aware of some other similar framework we can adapt to our needs?
You can certainly build a view dynamically in JSF. Without knowing more details about what you are building, I can't proscribe a best approach, but here are a few ways to build a view on the fly:
This can get tricky sometimes because when you mix JSTL with JSF tags, you need to learn where in the rendering lifecycle each kind of tag will execute to get it to do what you want, but once you learn that, it's the most straightforward approach.
I took this approach to dynamically generate forms in an application. The forms would change depending on the type of report, the type of user, and a very large number of other criteria. I simply bound a panel grid JSF component to a field on the server side, and then started creating the child elements "by hand" (for example: UISelectOne dropdown = new UISelectOne();), adding them as children to the panel grid (ex: panelgrid.getChildren().add(dropdown);) as I went along.
It doesn't have to be a panelgrid, of course, it could be a PrimeFaces Layout control, where you dynamically generate the layoutUnit children. The point is, any control can be bound to a variable in a managed bean, and you can manipulate it on the server side based on whatever criteria you want.