Monday 15 March 2010

jsf 2 - JSF template not applied -


I'm running in a problem with JSF and templating. I am following the following, but I see only one output which I have in my index.xhtml

  and lt; Ui: define with composition template = "/ WEB-INF / templates / BasicTemplate. XHTML" & gt; & Lt; Ui: Define name = "content" & gt; My custom content & lt; / UI: defined & gt;   

Despite adding footer and header, I am not defining / overwriting default one in my index file.

If I see the source in the browser as in my index.xhtml it looks like with UI: composition etc. It seems that it is not converting to "HTML".

My Web Xml :

  & lt; Servlet & gt; & Lt; Details & gt; Controller servlet for data input & lt; / Description & gt; & Lt; Display-name & gt; InputServlet & lt; / Display-name & gt; & Lt; Servlet-name & gt; InputServlet & lt; / Servlet-name & gt; & Lt; Servlet category & gt; Form.controller.InputServlet & lt; / Servlet category & gt; & Lt; / Servlet & gt; & Lt; Servlet-mapping & gt; & Lt; Servlet-name & gt; InputServlet & lt; / Servlet-name & gt; & Lt; URL pattern & gt; * JSF & Lt; / Url pattern & gt; & Lt; / Servlet-mapping & gt; & Lt; Welcome-file-list & gt; & Lt; Welcome-file & gt; Index.xhtml & lt; / Welcome-file & gt; & Lt; / Welcome-file-list & gt;   

My directory structure looks like this:

Thanks!

You are using the wrong servicelet.

JSF comes with your own servlet, FacesServlet .

Code> InputServlet to web.xml and see JSF's FacesServlet like this:

  & lt; Servlet & gt; & Lt; Servlet-name & gt; FacesServlet & lt; / Servlet-name & gt; & Lt; Servlet category & gt; Javax.faces.webapp.FacesServlet & lt; / Servlet category & gt; & Lt; / Servlet & gt; & Lt; Servlet-mapping & gt; & Lt; Servlet-name & gt; FacesServlet & lt; / Servlet-name & gt; & Lt; URL pattern & gt; * Xhtml & Lt; / Url pattern & gt; & Lt; / Servlet-mapping & gt;   

Should do this.

See also:
  • - There is a hello world and links to many tutorials

No comments:

Post a Comment