-
1. Re: Read a xhtml and return a UIComponent
christian.bauer Sep 10, 2009 2:35 PM (in response to jean.baldessar)This is quite difficult with Facelets. Look at the source code of this website for an example.
-
2. Re: Read a xhtml and return a UIComponent
jean.baldessar Sep 10, 2009 2:54 PM (in response to jean.baldessar)- This is quite difficult with Facelets - hmm... so its possible...
- Look at the source code of this website for an example. - this website? The seamframework.org website? Where do I get the source?
Does anyone already had to do a dynamic include and found the same problem?
-
3. Re: Read a xhtml and return a UIComponent
christian.bauer Sep 10, 2009 2:56 PM (in response to jean.baldessar)Look about 10cm left, then 5cm up on your screen.
-
4. Re: Read a xhtml and return a UIComponent
jean.baldessar Sep 10, 2009 2:59 PM (in response to jean.baldessar)thanks! :)
-
5. Re: Read a xhtml and return a UIComponent
jean.baldessar Sep 10, 2009 7:07 PM (in response to jean.baldessar)Christian, the source is too much complicated for my poor brain. Can you be more specific?
-
6. Re: Read a xhtml and return a UIComponent
christian.bauer Sep 10, 2009 7:11 PM (in response to jean.baldessar)That's because it actually is quite complicated. You need to write a facelets handler that creates a custom component sub-tree, which is then hooked into the existing tree at the right times. Now, since you didn't specify what you actually want to do, we don't know if that's what you really need.
-
7. Re: Read a xhtml and return a UIComponent
jean.baldessar Sep 10, 2009 7:23 PM (in response to jean.baldessar)I want to do something like that:
public class MyBackingBean { HtmlAjaxOutputPanel bindingPanel; public void addSomethingInThePanel(){ UIComponent someThing = readXhtml("/includes/page123.xhtml"); bindingPanel.getChildren().add(bindingPanel); } private UIComponent readXhtml(String string) { // TODO some complicated code? return null; } }
but I dont know how to implement the readXhtml method...
-
8. Re: Read a xhtml and return a UIComponent
christian.bauer Sep 10, 2009 7:35 PM (in response to jean.baldessar)Look at all the classes in this package. It's not really the same but close enough.
What this does is, it takes a custom tag such as <wiki:formattedText/> in your original template and then internally builds a whole component sub-tree that replaces (or is a child of, I forgot) of the formattedText component. The formattedText value is actually searched for macros and if those macros name a plugin template, that plugin template is loaded and inserted. For you it might just be enough to look at the basic setup of Facelet handlers and how that plugin template loading + insertion works. There is also a custom Facelets ViewHandler in the wiki that can load XHTML files from the classpath as resources.
Don't forget to look into the configuration files for enabling this stuff.
-
9. Re: Read a xhtml and return a UIComponent
jean.baldessar Sep 10, 2009 9:06 PM (in response to jean.baldessar)thanks Christian, but it's still realy complicated to me. :(
-
10. Re: Read a xhtml and return a UIComponent
jean.baldessar Sep 10, 2009 9:34 PM (in response to jean.baldessar)The method includeFacelet(UIComponent parent, String path) of FaceletContext seens to resolve my problem, but I don't know how to access it from my backingBean.
-
11. Re: Read a xhtml and return a UIComponent
jean.baldessar Sep 16, 2009 3:25 PM (in response to jean.baldessar)