0
votes

I`m using all the jsf 2.2 new namespaces

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:jsf="http://xmlns.jcp.org/jsf"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsp/jstl/core">

But how much do I try to use component selectOneMenu with selectItem I receive this error:

HTTP Status 500 - Elements with namespace http://xmlns.jcp.org/jsf/html may not have attributes in namespace http://xmlns.jcp.org/jsf. Namespace http://xmlns.jcp.org/jsf is intended for otherwise non-JSF-aware markup, such as <input type="text" jsf:id > It is not valid to have <h:commandButton jsf:id="button" />.

This is my selectOneMenu:

<h:selectOneMenu class="form-control"
    id="selectOlhos" jsf:value="#{corpoController.corpo.corOlhos}">
        <f:selectItem  itemLabel="Escolha" itemValue=""></f:selectItem>
        <f:selectItem  itemLabel="Verdes Claros" itemValue="Verdes Claros"></f:selectItem>
        <f:selectItem  itemLabel="Verdes Escuros" itemValue="Verdes Escuros"></f:selectItem>
        <f:selectItem  itemLabel="Castanhos Claros" itemValue="Castanhos Claros"></f:selectItem>
        <f:selectItem  itemLabel="Castanhos Escuros" itemValue="Castanhos Escuros"></f:selectItem>  
</h:selectOneMenu>

If I remove this component it works perfectly. Any help?

1
Great idea! ;-)Kukeltje

1 Answers

1
votes

Elements with namespace http://xmlns.jcp.org/jsf/html may not have attributes in namespace http://xmlns.jcp.org/jsf. Namespace http://xmlns.jcp.org/jsf is intended for otherwise non-JSF-aware markup, such as <input type="text" jsf:id > It is not valid to have <h:commandButton jsf:id="button" />.

The error literally says that you may not use jsf:xxx attributes in <h:xxx> elements.

I'm not sure how I can explain that more clearly. The error basically says that the jsf:xxx attributes should only be used on plain HTML elements such as <div>. The jsfxxx attribtues are not supported on <h:xxx> elements.

In your specific case, this is thus wrong:

<h:selectOneMenu ... jsf:value="...">

Instead, you must be using:

<h:selectOneMenu ... value="...">

Or, if you actually want to use the <h:selectOneMenu> as a so-called passthrough element, then you should be using plain HTML <select> instead.

<select ... jsf:value="...">

See also: