Hello,
I am trying to include a facelet from the Custom Component class. What happens is when I call the custom component it includes the facelet, but never renders the JSF tags but only the plain html tags.<br/><br/>
In the example below, I am calling by customtag from Page1.xhtml, which later also includes page3.xhtml. Again problem is, when customTag includes page2.xhtml, the JSF tags dont get rendered. De we need to create a custom renderer? then How?<br/><br/>
Any solution will be appreciated.<br/><br/>
Code Below:<br/><br/><br/>
public class [b]UICustomTag[/b] extends UIComponentBase
{
public void encodeEnd(FacesContext context) throws IOException {<br/>
System.out.println("Entering: UICustomTag.encodeEnd()");<br/>
try {<br/>
ExternalContext extrnalContext = context.getExternalContext();<br/>
javax.servlet.ServletContext servletContext = <br/>(javax.servlet.ServletContext) extrnalContext.getContext();<br/>
HttpServletRequest request = (HttpServletRequest) <br/>extrnalContext.getRequest();
HttpServletResponse response = (HttpServletResponse) extrnalContext.getResponse();<br/><br/>
<br/>//How to do the below include?<br/>
[b]RequestDispatcher rd = servletContext.getRequestDispatcher("/page2.xhtml");<br/>
rd.include(request, response);[/b]
<br/><br/>
} catch (Exception e) {
e.printStackTrace();
}<br/><br/>
ResponseWriter writer = context.getResponseWriter();
writer.write("<div> Line 5: hello from UICustomTag class! - TR</div>");<br/>
writer.close();<br/><br/>
System.out.println("Leaving: UICustomTag.encodeEnd()");<br/>
}<br/><br/>
@Override
public String getFamily() {
// TODO Auto-generated method stub
return "family";
}
}
<br/><br/>
[b]Page 1:[/b]
.<br/>.<br/>.<br/>.<br/>
[b] Line 1: Here is the customtag usage[/b]:<br/>
<d:customtag/> <br/>
<br/><br/>
<!-- now include another page -->
<br/>
<h:outputText value="Line 6: Okay, now we are calling page3:"/>
<br/>
<ui:include src="page3.xhtml"/>
<br/><br/>
[b]Page 2:[/b]<br/>
.<br/>.<br/>.<br/>
<br/>
Line 2: This is a simple JSF Page 2.
<br/>
<br/><!-- these JSF tags are not rendering... --><br/>
<h:outputText id="id2" value=" Line 3: Page 2 outputText *************************** "/>
<br/><br/>
<h:outputText id="id2" value=" Line 4: Page 2 outputText MORE TEXT..... !! !! !! !!* "/>
<br/>
<br/>
[Message sent by forum member 'tahirraza' ]
http://forums.java.net/jive/thread.jspa?messageID=372178