0
votes

I am trying to create a composite component in JSF Facelets 1.2.8. The component is supposed to be a table optimised to work with the jquery jstree framework for presenting a table as a directory tree.

The component is supposed to accept an attribute containing a xml value, which represents the structure of the tree. In Order to prepare the component for the presentation as file tree I want to parse the xml data in the components xhtml file.

For this I want to use the JSTL-XML-Taglibrary but it seems like it cant be found. This is how my namespace declaration looks like:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:x="http://java.sun.com/jstl/xml">

The core-tag library can be used but every tag from the xml-library is adopted as plain text into the html source.

I tried following:

  • Changing the namespace declarations between jstl 1 and jstl 1.2 (insert additional /jsp/ in path)
  • javax.servlet.jstl 1.2 is imported via maven
  • I added xercesImpl.jar and xalan.jar in the lib directory of my tomcat installation (v. 7.0.68)

I have no clue why the core-library is working but the xml-library doesn't. Is there something I am doing wrong? Is it even possible to use JSTL-XML in Facelets?

Thanks in advance Demli

1

1 Answers

2
votes

The JSTL XML (and SQL) taglibs are considered bad practices and are "officious" deprecated since JSP 2.0 (2003) wherein the MVC approach was strongly preferred and advocated over tight-coupling the controller and the model into the view. Facelets, which was introduced a bit later (2005), has even no support for JSTL XML and SQL taglibs at all. Only JSTL core and functions are supported.

If you're absolutely positive that you need to massage a XML file into a XHTML file, then better use XSL instead. You can find a kickoff example here: How to create dynamic JSF form fields.

See also: