开发者

JSF2: Building JSF2 views (whole component trees) at runtime

开发者 https://www.devze.com 2023-02-22 13:48 出处:网络
Currently I\'m trying JSF 2.0 and still learning the more advanced features. JSF2 is comfortable when having to deal with pre-defined views (fixed component trees) whose widgets are completely known a

Currently I'm trying JSF 2.0 and still learning the more advanced features.

JSF2 is comfortable when having to deal with pre-defined views (fixed component trees) whose widgets are completely known at compile time -- of course with the exception of repeating data list/table entries and light dynamic modification of forms via the DataTable "trick" (as I read here, especially under JSF2, can I add JSF components dynamically? and How to create dynamic JSF 1.2 form fields).

Now I'm wondering about the realization of completely dynamic JSF2 component trees, where a web user, for each given content type (e.g. 'Person', 'PersonList' but also 'PersonalManagementPanel'), can choose one from a list of content-type compatible widgets (=JSF custom components).

As result, this user will always see the "Personal Manager Page" rendered with his/her prefered "PersonalManagerPanel", which in turn also renders its nested components ('Person', 'PersonList') with the user's preferred vari开发者_JAVA百科ants.

Obviously, the goal is to get a selectively configurable/customizable JSF Page -- at runtime.

  1. Is this scenario realizable in JSF2? -- How could this be done?

  2. Are there more appropriate Java technologies for this requierement?

    -- One possible alternative I'm thinking of is XML plus XSLT.

Thank you very much for your help and suggestions.

Best regards

Martin


You can use something like this:

<ui:include src="#{bean.template}" />

Or if you want more complicated components, you should take a look at the PreRenderViewEvent.

Note that there are issues with both solutions.

  • http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-770
  • http://java.net/jira/browse/JAVASERVERFACES-1708
  • http://java.net/jira/browse/JAVASERVERFACES-2041
0

精彩评论

暂无评论...
验证码 换一张
取 消