This content has been marked as final.
Show 7 replies
-
1. Re: how to create include pages dynamically
nbelaevski Jan 8, 2010 3:09 PM (in response to lalit_1234)You can bind "src" attribute to the bean property to set the included page dynamically. -
2. Re: how to create include pages dynamically
bitec Jan 10, 2010 3:29 PM (in response to lalit_1234)Hi.
What about dynamic include in the iteration loop? Here is the simple example:
{code}<rich:dataGrid value="#{someCollection} var="item"> <ui:include src="/folder/#{item}_file.xhtml"/> </rich:dataGrid{code}
I know that facelets includes are evaluated during the view rendering, not the actual components tree parsing, that's why dynamic include will not happen (a4j:include acts the same). But may be anyone knows the workarounds for this problem?
-
3. Re: how to create include pages dynamically
danielft Jan 9, 2010 5:04 PM (in response to lalit_1234)if you have access to FaceletContext (ComponentHandler in example) you can do this:
protected UIComponent createComponent(FaceletContext ctx) { UILookUp c = (UILookUp) super.createComponent(ctx); try { ctx.includeFacelet(((UILookUp)c).getModal(), "/jsp/common/city/teste.jsf"); } catch (exceptiom e) { e.printStackTrace(); } return c; }
-
4. Re: how to create include pages dynamically
lalit_1234 Jan 10, 2010 7:47 AM (in response to danielft)where i will get this UILookUp class,it is showing error -
5. Re: how to create include pages dynamically
danielft Jan 10, 2010 9:15 AM (in response to lalit_1234)this is my class .
this method only will work if you have a custom component. in my case, the getModal return a org.richfaces.component.html.HtmlModalPanel. The page insert into modalpanel .
-
6. Re: how to create include pages dynamically
nbelaevski Jan 11, 2010 6:00 PM (in response to bitec)c:forEach can be used in this case. -
7. Re: how to create include pages dynamically
nbelaevski Jan 11, 2010 6:05 PM (in response to danielft)Here's how Facelets handler for a4j:include is implemented: http://fisheye.jboss.org/browse/~raw,r=14239/RichFaces/branches/community/3.3.X/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java