0

I got problems making a project. Some h tags won't show in the view.

This is the view code:

<?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://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      >
    <h:head>
        <title>Facelet Title</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
    </h:head>
    <h:body>
        <div id="main">
            <div id="header">
            </div>

            <div id="menu">
                <ul>
                    <li><a href="#">Admin</a></li>
                    <li><a href="#">Home</a></li>
                </ul>
            </div>

            <div id="content">
                <h1>Lijst van opleidingen</h1>                         
                <h:dataTable var="o" value="#{opleidingController.findAll()}" border="0" >
                    <h:column>
                        <f:facet name="header">Code</f:facet>
                        <h:outputText value="#{o.opl_code}"></h:outputText>
                    </h:column>
                    <h:column>
                        <f:facet name="header">Titel</f:facet>
                        <h:outputText value="#{o.opl_titel}"></h:outputText>
                    </h:column>
                    <h:column>
                        <f:facet name="header">Thema</f:facet>
                        <h:outputText value="#{o.opl_thema}"></h:outputText>
                    </h:column>
                    <h:column>
                        <f:facet name="header">Delete</f:facet>
                        <h:graphicImage id="delete" url="images/delete.gif" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">Edit</f:facet>
                        <h:graphicImage id="edit" url="images/edit.gif" />
                    </h:column>
                </h:dataTable>
                <br /><br />
                <h:button value="Nieuwe Opleiding" outcome="add"></h:button>
                <a href ="add.xhtml">Nieuwe opleiding</a> 
            </div>
        </div>
    </h:body>
</html>

I can see the a tag but not the h:button. This is a picture of the view in my browser (The database is still empty, that is why there are no items in the list).

Image is found here

Probably this is a known simple answer, so I'll be extremely happy to learn new things!

EDIT:

I did the steps BalusC gave me. This fixed it for another page I also had problems with. But the page I talked about earlier is still not parsing the xhtml. I got the tip to include the source code, which I'll do:

<?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://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      >
    <h:head>
        <title>Facelet Title</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
    </h:head>
    <h:body>
        <h:form>
            <div id="main">
                <div id="header">
                </div>

                <div id="menu">
                    <ul>
                        <li><a href="#">Admin</a></li>
                        <li><a href="#">Home</a></li>
                    </ul>
                </div>

                <div id="content">
                    <h1>Lijst van opleidingen</h1>                         
                    <h:dataTable var="o" value="#{opleidingController.findAll()}" border="0" >
                        <h:column>
                            <f:facet name="header">Code</f:facet>
                            <h:outputText value="#{o.opl_code}"></h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">Titel</f:facet>
                            <h:outputText value="#{o.opl_titel}"></h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">Thema</f:facet>
                            <h:outputText value="#{o.opl_thema}"></h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">Delete</f:facet>
                            <h:graphicImage id="delete" url="images/delete.gif" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">Edit</f:facet>
                            <h:graphicImage id="edit" url="images/edit.gif" />
                        </h:column>
                    </h:dataTable>
                    <br /><br />
                    <h:button value="Nieuwe Opleiding" outcome="add"></h:button>
                    <a href ="add.xhtml">Nieuwe opleiding</a> 
                </div>
            </div>
        </h:form>
    </h:body>
</html>
Deflandrex
  • 11
  • 1
  • Place all inside a `` as `h:button` will create an HTML `` which should be inside a form, especially with XML. – Joop Eggen May 03 '17 at 22:45
  • Hi Joop, putting everything in a does not seems to fix it. – Deflandrex May 03 '17 at 23:00
  • I think I was wrong and a `h:commandButton` must be in a `h:form`. Sorry. – Joop Eggen May 03 '17 at 23:06
  • Can you check the generated html for that button? My guess is that your css is overriding the default button style? – Ouerghi Yassine May 04 '17 at 00:57
  • @Deflandrex: the 'view' source is in these cases always, ok mostly always, better to use when debugging or posting questions than images. Then you'd (most likely) seen that the h:button on the client-side still is an h:button (which should not be the case) and you'd be able to easier find a cause of that without the need for asking a new question – Kukeltje May 04 '17 at 07:41
  • The 'view-source' of the client side.... If that is still identical which what you have client-side, you have, with 99.9% certainty, still one of the three problems mentioned in the duplicate. Find the differences with the page you got it fixed for... – Kukeltje May 04 '17 at 18:50
  • I found out what the problem was and it makes me feel extremely retarded. I didn't know browsers cache a whole local page.. And only that page.. After I cleared cache it was working fine with the solution BalusC gave.. It's so strange it was only that one page that wasn't updating... Anyway thank you all for the help.. Sorry for your time. – Deflandrex May 07 '17 at 16:32

0 Answers0