cgennari
cgennari

Reputation: 1

a slippery JSF syntax error

If I try to display a JSF 2 page on Tomcat 7.0.34 with:

like this one:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:p="http://primefaces.org/ui"
  xmlns:cis="http://java.sun.com/jsf/composite/comp">

<h:head>
  <title>Prova errore di sintassi</title>
</h:head>
<h:body>
  <f:view>
    <ui:include src="/WEB-INF/include/menubar.xhtml" />
    <h:form>
      <p:ajaxStatus style="width: 32px;height: 32px;" />
      <p:growl />
      <p:panel id="pannello">
    <p:focus />
    <p:messages
      showDetail="true"
      globalOnly="true" />
    <h:panelGrid columns="3">
      <p:outputLabel
        for="ckpensionat2"
        value="Pens2"
        title="tit x pens2"
        style="padding-right: 3px;  display: inline-block; min-width: 60px;" />
      <p:selectBooleanCheckbox
        id="ckpensionat2"
        value="#{miocomp.pensionato}"
        title="tit x pens2"
        valueChangeListener="#{miocomp.pensCambiato}" />
      </p:selectBooleanCheckbox>
      <h:outputLabel  value="pippo" />
      </h:outputLabel>
      <p:message for="ckpensionat2" />
      <p:commandButton
        value="agg"
        update="pannello" />
    </h:panelGrid>
      </p:panel>
    </h:form>
  </f:view>
</h:body>
</html>

Nothing is showing! please pay attention to the error of double closing tag

 .../>
 </p:selectBooleanCheckbox>
 <h:outputLabel  value="pippo" />
 </h:outputLabel>

My questions are:

  1. why </h:outputLabel> is evincted like a syntax error on Eclipse while </p:selectBooleanCheckbox> not
  2. when I try to show this page I get a blank page. If I remove the error all goes fine.
  3. no errors at all appears on my log view neither on tomcat 7 log dir

thanks in advance for any suggestions

Upvotes: 0

Views: 181

Answers (1)

Tasos P.
Tasos P.

Reputation: 4114

  1. It is a syntax error (invalid XML) since in <h:outputLabel value="pippo" /> </h:outputLabel> you close the tag twice; once with the /> end tag and secondly with the </h:outputLabel> element. Also, p:selectBooleanCheckbox doesn't have title attribute. I'm pretty sure IDE can't validate the rest of the document because of these errors, so it only complains about the first.
  2. That's normal...
  3. I believe you should increase the log level or change the javax.faces.PROJECT_STAGE parameter to Development in your app's web.xml

Upvotes: 1

Related Questions