"no tag was found" Error
I am trying to implement a very simple RichFaces application (following the example at the developer guide, but am encountering an error I cannot solve.
My code appears to build and deploy correctly to Tomcat (localhost), but when the index page is opened I get the exception:
javax.faces.view.facelets.TagException: /index.xhtml @13,19 <a4j:form> Tag Library supports namespace: http://richfaces.org/a4j, but no tag was defined for name: form
The index page I am attempting to load is as follows:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitio开发者_运维技巧nal//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:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body><f:view>
<a4j:form>
<rich:panel header="This is the title" style="width:400px;">
<h:outputText value="Enter your name:"/>
<h:inputText value="#{MyBean.message}">
<f:validateLength minimum="1" maximum="20"/>
</h:inputText>
</rich:panel>
</f:view></a4j:form>
</h:body>
</html>
This is the same as the example in the developer guide, as far as I can tell. I am developing within Netbeans 6.8, using the MyFaces implementation of JSF 2.0, and have added RichFaces and Apache Commons jar's as libraries, and the tag the exception is stating is actually auto-suggested by Netbeans!
From Apache Commons, I have added:
beanutils, collections, digester, loggingFrom RichFaces, I have added: richfaces-api, richfaces-impl, richfaces-impl-jsf2, richfaces-ui
If it would be useful to provide the bean code and/or web.xml, please say so, I just wanted to avoid a huge post for what may be a simple mistake.
For RichFaces 4.x use "rich:popupPanel". I got it from RichShowCase:
<a4j:status onstart="#{rich:component('statPane')}.show()"
onstop="#{rich:component('statPane')}.hide()" />
<h:form id="form">
<rich:dataTable value="#{carsBean.allInventoryItems}" var="car"
iterationStatusVar="it" id="table" rows="15">
<rich:column>
<f:facet name="header">#</f:facet>
#{it.index}
</rich:column>
<rich:column>
<f:facet name="header">Vendor</f:facet>
<h:outputText value="#{car.vendor}" />
</rich:column>
<rich:column>
<f:facet name="header">Model</f:facet>
<h:outputText value="#{car.model}" />
</rich:column>
<rich:column>
<f:facet name="header">Price</f:facet>
<h:outputText value="#{car.price}" />
</rich:column>
<rich:column>
<f:facet name="header">Mileage</f:facet>
<h:outputText value="#{car.mileage}" />
</rich:column>
<rich:column>
<f:facet name="header">VIN</f:facet>
<h:outputText value="#{car.vin}" />
</rich:column>
<rich:column>
<a4j:commandLink styleClass="no-decor" execute="@this"
render="@none" oncomplete="#{rich:component('confirmPane')}.show()">
<h:graphicImage value="/images/icons/delete.gif" alt="delete" />
<a4j:param value="#{it.index}"
assignTo="#{carsBean.currentCarIndex}" />
</a4j:commandLink>
<a4j:commandLink styleClass="no-decor" render="editGrid"
execute="@this" oncomplete="#{rich:component('editPane')}.show()">
<h:graphicImage value="/images/icons/edit.gif" alt="edit"/>
<a4j:param value="#{it.index}"
assignTo="#{carsBean.currentCarIndex}" />
<f:setPropertyActionListener target="#{carsBean.editedCar}"
value="#{car}" />
</a4j:commandLink>
</rich:column>
<f:facet name="footer">
<rich:dataScroller page="#{carsBean.page}" />
</f:facet>
</rich:dataTable>
<a4j:jsFunction name="remove" action="#{carsBean.remove}"
render="table" execute="@this"
oncomplete="#{rich:component('confirmPane')}.hide();" />
<rich:popupPanel id="statPane" autosized="true">
<h:graphicImage value="/images/ai.gif" alt="ai" />
Please wait...
</rich:popupPanel>
<rich:popupPanel id="confirmPane" autosized="true">
Are you sure you want to delete the row?
<a4j:commandButton value="Cancel"
onclick="#{rich:component('confirmPane')}.hide(); return false;" />
<a4j:commandButton value="Delete" onclick="remove(); return false;" />
</rich:popupPanel>
<rich:popupPanel header="Edit Car Details" id="editPane" domElementAttachment="parent" width="400" height="170">
<h:panelGrid columns="3" id="editGrid">
<h:outputText value="Vendor" />
<h:outputText value="#{carsBean.editedCar.vendor}" />
<h:panelGroup />
<h:outputText value="Model" />
<h:outputText value="#{carsBean.editedCar.model}" />
<h:panelGroup />
<h:outputText value="Price" />
<h:inputText value="#{carsBean.editedCar.price}" required="true"
requiredMessage="Price is required" id="price"
converterMessage="Should be a valid price"
validatorMessage="Should be a valid price" label="Price field">
<f:validateDoubleRange/>
</h:inputText>
<rich:message id="priceMsg" for="price" />
<h:outputText value="Mileage" />
<h:inputText value="#{carsBean.editedCar.mileage}" id="mage"
converterMessage="Should be a valid mileage"
validatorMessage="Should be a valid mileage" label="Mileage field" >
<f:validateDoubleRange/>
</h:inputText>
<rich:message id="madeMsg" for="mage" />
<h:outputText value="VIN" />
<h:inputText value="#{carsBean.editedCar.vin}" id="vin"
required="true" validatorMessage="Not a valid 17-digit VIN"
converterMessage="Not a valid 17-digit VIN"
requiredMessage="VIN is required">
<f:validateLength minimum="17" maximum="17" />
</h:inputText>
<rich:message id="vinMsg" for="vin" />
</h:panelGrid>
<a4j:commandButton value="Store" action="#{carsBean.store}"
render="table" execute="editPane"
oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('editPane')}.hide();}" />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('editPane')}.hide(); return false;" />
</rich:popupPanel>
</h:form>
I am using Richfaces 3.3.3.Final with Myfaces 2.0.1 without any problem.
Make sure you've added facelets-1.1.15.B1 And the following context params in web.xml
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
<param-value>true</param-value>
</context-param>
and try the following modified snippet
<?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:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<title>Facelet Title</title>
</head>
<body>
<a4j:form>
<rich:panel header="This is the title" style="width:400px;">
<h:outputText value="Enter your name:"/>
<h:inputText value="#{MyBean.message}">
<f:validateLength minimum="1" maximum="20"/>
</h:inputText>
</rich:panel>
</a4j:form>
</body>
</html>
There was a problem with f:view
it was declared after the body but closed before </a4j:form>
Are you using RichFaces 3.x? I had the same problem recently (although in my case I couldn't use the JSF2.0 h:button) and my teammate googled that it's something with the techology and we simply have to wait for RichFaces 4.0 (if you won't solve it and really want I can ask him tomorrow for a link if he still has it).
I see you have added both richfaces-impl and richfaces-impl-jsf2 jars. As per the recommendation you should only add the latter if you are using jsf 2.0.
精彩评论