maximus
maximus

Reputation: 11524

<h:input> Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: input

I am trying to implement jsf + primefaces + twitter bootstrap:

<!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:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.prime.com.tr/ui"
>
<h:head>
    <title>IMPORT JSF SET ATTRIBUTES</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="" />
    <meta name="author" content="" />

    <!-- Le styles -->
    <h:outputStylesheet name="css/bootstrap.css" />
    <h:outputStylesheet name="css/bootstrap.min.css" />
    <h:outputStylesheet name="css/override.css" />

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

    <!-- Le fav and touch icons
<link rel="shortcut icon" href="../assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
-->
</h:head>
<h:body>
    <div class="navbar navbar-inverse navbar-static-top">
        <div class="navbar-inner navbar-large">
            <div class="container">
                <a class="brand" href="#">Name</a>
                <ul class="nav">
                    <li><a href="#buy">Link</a></li>
                    <li><a href="#about">Link</a></li>
                </ul>
                <form class="navbar-form pull-left">
                    <div class="input-append offset1">
                        <h:input class="span5" placeholder="put search terms here"
                            type="text" />
                        <button class="btn" type="submit">
                            <i class="icon-search"></i>
                        </button>
                    </div>
                </form>
                <ul class="nav pull-right">
                    <li class="dropdown"><a class="dropdown-toggle"
                        data-toggle="dropdown" href="#"> How to <b class="caret"></b>
                    </a>
                        <ul class="dropdown-menu">
                            <li class="nav-header">Link</li>
                            <li><a href="#">Link 1</a></li>
                            <li><a href="#">Link 2</a></li>
                            <li><a href="#">Link 3</a></li>
                            <li class="divider"></li>
                            <li class="nav-header">Link</li>
                            <li><a href="#">Link 1</a></li>
                            <li><a href="#">Link 2</a></li>
                            <li><a href="#">Link 3</a></li>
                        </ul></li>
                    <li><a href="#login">Login</a></li>
                    <li><a href="#register">Signup</a></li>
                </ul>
            </div>
        </div>
    </div>

    <div class="container">[Template content will be inserted here]</div>

    <footer>
    <ul class="inline text-center">
        <li>© 2013</li>
    </ul>
    </footer>
    <!--/.fluid-container-->

    <!-- Le javascript
================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <h:outputScript name="js/jquery-1.7.2.min.js" />
    <h:outputScript name="js/bootstrap.min.js" />
    <h:outputScript name="js/jquery.dataTables.min.js" />
    <h:outputScript name="js/bootstrap.js" />

</h:body>
</html>

However, I get:

<h:input> Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: input

I really appreciate your answer!

Upvotes: 1

Views: 10737

Answers (2)

Jan Piel
Jan Piel

Reputation: 540

I have a question, are you sure you mean h:input and not h:inputtext?

sorry -> edit: you are doing the follwing:

          <form class="navbar-form pull-left">
                <div class="input-append offset1">
                    <h:input class="span5" placeholder="put search terms here"
                        type="text" />
                    <button class="btn" type="submit">
                        <i class="icon-search"></i>
                    </button>
                </div>
            </form>

and thats plain html, won't work with JSF if you wanna use the magic of JSF you must do something like that:

            <h:form>
                    <h:inputText value="#{hereIsYourManagedBean.field}" />
                    <h:commandButton action="#{hereIsYourManagedbean.action}">
                         DoJsfAction
                    </h:commandButton >

            </h:form>

The JSF-Servlet will catch your action, render the input form, put it in your ManagedBean fields, call the method of the ManagedBean and finally create a response, depending on your method. Mostly another xhtml-site which is configured by your faces-config.xml

Upvotes: 0

partlov
partlov

Reputation: 14277

h:input tag doesn't exist in JSF. Use some of specific input tags, for example: h:inputHidden, h:inputText, h:inputSecret, h:inputTextarea.

Upvotes: 6

Related Questions