E ai galera , blz
Eu estou tentando usar o exemplo do richfaces 4 do site da Jboss, o panelMenu, segue link abaixo:
http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=panelMenu&skin=blueSky
Porém, está dando um erro na minha aplicação, ele exibe a seguinte mensagem na pagina xhtml
?The button/link/text component needs to have a Form in its ancestry. Please add <h:form>.
Já tentei mudar a localização do meu <h:form>, mas ainda sim continua dando a mensagem, onde q eu tenho q colocar isso no codigo?
menu.xhtml
[code]
<h:form id="form">
<h:panelGrid columns="2" columnClasses="cols,cols" width="400">
<rich:panelMenu style="width:200px" itemMode="ajax" groupMode="ajax"
groupExpandedLeftIcon="triangleUp"
groupCollapsedLeftIcon="triangleDown"
topGroupExpandedRightIcon="chevronUp"
topGroupCollapsedRightIcon="chevronDown" itemLeftIcon="disc"
itemChangeListener="#{panelMenuBean.updateCurrent}">
<rich:panelMenuGroup label="Group 1">
<rich:panelMenuItem label="Item 1.1" name="Item_1_1" />
<rich:panelMenuItem label="Item 1.2" name="Item_1_2" />
<rich:panelMenuItem label="Item 1.3" name="Item_1_3" />
</rich:panelMenuGroup>
<rich:panelMenuGroup label="Group 2">
<rich:panelMenuItem label="Item 2.1" name="Item_2_1" />
<rich:panelMenuItem label="Item 2.2" name="Item_2_2" />
<rich:panelMenuItem label="Item 2.3" name="Item_2_3" />
<rich:panelMenuGroup label="Group 2.4">
<rich:panelMenuItem label="Item 2.4.1" name="Item_2_4_1" />
<rich:panelMenuItem label="Item 2.4.2" name="Item_2_4_2" />
<rich:panelMenuItem label="Item 2.4.3" name="Item_2_4_3" />
</rich:panelMenuGroup>
<rich:panelMenuItem label="Item 2.5" name="Item_2_5" />
</rich:panelMenuGroup>
<rich:panelMenuGroup label="Group 3">
<rich:panelMenuItem label="Item 3.1" name="Item_3_1" />
<rich:panelMenuItem label="Item 3.2" name="Item_3_2" />
<rich:panelMenuItem label="Item 3.3" name="Item_3_3" />
</rich:panelMenuGroup>
</rich:panelMenu>
<a4j:outputPanel ajaxRendered="true">
<rich:panel rendered="#{not empty panelMenuBean.current}">
<h:outputText value="#{panelMenuBean.current} selected"
id="current" />
</rich:panel>
</a4j:outputPanel>
</h:panelGrid>
</h:form>
</h:body>
[/code]
PanelMenuBean.java
[code]/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
package br.salesianos.efeito;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import org.richfaces.event.ItemChangeEvent;
@ManagedBean
@RequestScoped
public class PanelMenuBean {
private String current;
private boolean singleMode;
public boolean isSingleMode() {
return singleMode;
}
public void setSingleMode(boolean singleMode) {
this.singleMode = singleMode;
}
public String getCurrent() {
return this.current;
}
public void setCurrent(String current) {
this.current = current;
}
public void updateCurrent(ItemChangeEvent event) {
setCurrent(event.getNewItemName());
}
}
[/code]