Why isn't my <h:form> visible?

Berry

I'm trying to follow this tutorial on jsf: https://netbeans.org/kb/docs/web/jsf20-intro.html

In the "Wiring Managed Beans to Pages" chapter you have to switch the HTML form element for an equivalent JSF HTML form component. But after I do so (simply commenting/uncommenting already present code) it isn't visible.

I've added xmlns:h="http://xmlns.jcp.org/jsf/html" to the html tag; I get no errors from the IDE; the form shows up in inspect element; I've also tried xmlns:h="http://java.sun.com/jsf/html" instead, but still nothing.

Here's my page:

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://xmlns.jcp.org/jsf/html">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="css/stylesheet.css" rel="stylesheet" type="text/css" />
    <!--<h:outputStylesheet name="css/stylesheet.css" />-->

    <title>Greeting</title>
</head>

<body>
    <div id="mainContainer">

        <div id="left" class="subContainer greyBox">

            <h4>Hi, my name is Duke!</h4>

            <h5>I'm thinking of a number

                <br/>
                between
                <span class="highlight">0</span> and
                <span class="highlight">10</span>.</h5>

            <h5>Can you guess it?</h5>

            <!-- <form action="response.xhtml">
                <input type="text" size="2" maxlength="2" />
                <input type="submit" value="submit" />
            </form>-->

            <h:form>
                <h:inputText id="userNumber"
                             size="2"
                             maxlength="2"
                             value="#{UserNumberBean.userNumber}"/>

                <h:commandButton id="submit" value="submit" action="response"/>
            </h:form>
        </div>

        <div id="right" class="subContainer">

            <img src="duke.png" alt="Duke waving" />
            <!--<h:graphicImage url="/duke.png" alt="Duke waving" />-->

        </div>
    </div>
</body>

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
         xmlns="http://java.sun.com/xml/ns/javaee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
         http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
</web-app>
syntaxerror

JSF-Tags like <h:form> and <h:inputText> being returned to the client (your browser) instead of being rendered as proper HTML are a sure sign that your whole setup is wrong. (A browser will duly ignore any tags that it doesn't understand, that's why you don't get to see any of the contents of the form.)

If you are mapping your URL pattern like so:

<url-pattern>/faces/*</url-pattern>

you should then remove the second welcome file entry

<welcome-file>index.xhtml</welcome-file>

because this can never work, because it does NOT match against the pattern, so the whole request is NOT processed by FacesServlet in which case the plain .xhtml file is served as-is!

(It even says so explicitly in the tutorial you are referring to, at the end of the "Adding JSF 2.x Support to a Web Application" section.)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why isn't my React Form sending?

Why isn't my form working?

Why isn't my form submitting

Why isn't my PHP form working?

Why isn't my form saving but working with the API only?

Why isn't my Create Form working, or even responding?

Why isn't my form passing the id to the controller?

Image isn't visible in my site

Why isn't protected field visible to a subclass?

Why isn't my JScrollPane with a JTextArea visible when using null LayoutManager?

Why my image is hiding the h2? why isn't the nav rendering horizontally?

Why isn't my background-color not working on my HTML form in CSS?

Why isn't my C# endpoint understanding my Angular Reactive form data?

C: why my output isn't rounding up using the round() function in math.h?

Why isn't my monkey patching isn't working ?

why isn't my html form and button centered after using display: inline;

Why isn't my React bootstrap form rendering the values passed to the attributes?

Why isn't my PHP form working? I do receive the email but there is no content in it

Why isn't Formik.setStatus updating the Status state in my form?

Why does my form isn't reseting his styling after render?

Any idea on why my django LoginView form isn't being displayed?

My button isn't visible when I run the application

When I change my Css it isn't visible in the Html file

Why isn't this form returning results?

Why "dispose()" and "setVisible()" isn't close the form?

why isn't this login form code working?

Why isn't this ajax form resetting?

why isn't the color I added on the header background visible?

Why is horizontal scroll bar visible and vertical isn't?