Hi,
I'm migrating an existing JSP project to use facelets, and ran into the
following issue:

I discovered that the Trinidad renderkit doesn't producing valid XHTML
(at least when used with facelets). More specifically, it wasn't closing
tags like meta, input, link and a bunch of others, which led to a list
of warnings in my validator. (I was a little disappointed as I believe
that, for the sake of enforcing seperation of structure and
presentation, there's no good reason to default to anything but XHTML,
1.0 strict or transitional.) I went hunting for a solution which I found
in a mail by Matthias who advised using the contentType attribute on
<f:view> (see http://markmail.org/message/bu6g4s7momu6rifk).

So I started using <f:view contentType="application/xhtml+xml">, the
mimetype for XHTML, which worked great until I tried to migrate a page
with actual buttons. They simply didn't work anymore. When I switched
the contentType back to "text/html" all the components worked again, but
I was stuck with the same invalid markup that I was trying to avoid in
the first place.

Anyone have any ideas about how I can get valid XHTML markup *and*
working buttons? The guy who originally asked the question to which
Matthias responded apparently hit upon the same problem but doesn't
appear to have solved it either.

Here's the markup that I used:

<?xml version="1.0" encoding="UTF-8" ?>
  <html xmlns="http://www.w3.org/1999/xhtml";
xmlns:f="http://java.sun.com/jsf/core";
xmlns:tr="http://myfaces.apache.org/trinidad";>
    <head>
      <title>Bla</title>
    </head>

    <body>
    <f:view contentType="application/xhtml+xml">
      <tr:form defaultCommand="searchButton">
        <div id="searchbox">
          <tr:inputText value="#{searchBean.searchValue}" simple="true"
/>
          <tr:commandButton id="searchButton"
action="#{searchBean.searchNow}" text="Search" />
          <strong>#{searchBean.searchResult}</strong>
        </div>
      </tr:form>
    </f:view>
  </body>
</html>

If I change '<f:view contentType="application/xhtml+xml">' to '<f:view
contentType="text/html">', the "Search" button stops working.
Any ideas?

Regards,
Maarten 

Reply via email to