richFaces

tenho uma tabela e gostaria de pegar a linha selecionada e nao sei como faço…

estou usando o richFaces e <rich:extendedDataTable value="#{cooperadoHandler.listaCooperados}">

creio q o erro e devido ao tipo da var listaCooperados… mais nao sei q tipo fazer… na tabela mostra o nome e o cpf do objeto cooperado.

procurei na pagina http://livedemo.exadel.com/richfaces-demo/richfaces/extendedDataTable.jsf?tab=info&cid=249974 e nao encontrei o codigo da classe java
so o codigo do jsp!!!

   1. javax.servlet.ServletException: /jsp/cadastros/cadCooperado.jsp(305,1) '#{cooperadoHandler.linhaSelecionada}' Cannot convert [] of type class java.util.ArrayList to interface org.richfaces.model.selection.Selection  
   2.     javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)  
   3.     org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)  
   4.     org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)  
   5.     org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)  
   6.     org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) 

Obrigado ae galera… e desculpa qlqr coisa!

Bom isso conseguir resolver to com outro problema … rsrsrs

link bom pra ajudar http://lists.jboss.org/pipermail/richfaces-svn-commits/2008-December/011900.html
bom a solução do primeiro problema eh

private SimpleSelection selection;

O novo problema eh q nao consigo, apos o click na linha da tabela atualizar um campo pode ser <h:outputLabel> ou <h:outputText>
o importante e q funcione…

estou usando o Ajax pra fazer mais nao to conseguindo
pq nao consigo botar um metodo no parametro “action” e no site de referencia a cima ta
um metodo normal void… agora chama o meu metodo nao sei pq.

codigo do site

[code]public class ExtendedTableBean {
private String sortMode=“single”;
private String selectionMode=“multi”;
private HtmlExtendedDataTable table;
private SimpleSelection selection;
private List selectedCapitals = new ArrayList();

private ExtendedTableDataModel<Capital> dataModel;
private List<Capital> capitals = new ArrayList<Capital>();

public void takeSelection() {
	getSelectedCapitals().clear();
	Iterator<Object> iterator = getSelection().getKeys();
	while (iterator.hasNext()){
		Object key = iterator.next();
		table.setRowKey(key);
		if (table.isRowAvailable()) {
			getSelectedCapitals().add((Capital) table.getRowData());
		}
	}
} 
public void resetSelection() {
	getSelectedCapitals().clear();
}

public String getSortMode() {
	return sortMode;
}

@@ -57,29 +39,41 @@

public ExtendedTableBean() {
}

public ExtendedTableDataModel<Capital> getCapitalsDataModel() {
	if (dataModel == null) {
		dataModel = new ExtendedTableDataModel<Capital>(new DataProvider<Capital>(){

public HtmlExtendedDataTable getTable() {
	return table;
}
			private static final long serialVersionUID = 5054087821033164847L;

public void setTable(HtmlExtendedDataTable table) {
	this.table = table;
}
			public Capital getItemByKey(Object key) {
				for(Capital c : capitals){
					if (key.equals(getKey(c))){
						return c;
					}
				}
				return null;
			}

public SimpleSelection getSelection() {
	return selection;
}
			public List<Capital> getItemsByRange(int firstRow, int endRow) {
				return capitals.subList(firstRow, endRow);
			}

public void setSelection(SimpleSelection selection) {
	this.selection = selection;
}
			public Object getKey(Capital item) {
				return item.getName();
			}

public List<Capital> getSelectedCapitals() {
	return selectedCapitals;
			public int getRowCount() {
				return capitals.size();
			}
			
		});
	}
	return dataModel;
}

	this.selectedCapitals = selectedCapitals;
public void setCapitals(List<Capital> capitals) {
	this.capitals = capitals;
}

}
[/code]

jsp

[code]

ui:composition
<h:form>
<h:panelGrid columns=“2” columnClasses=“top , top”>
<rich:extendedDataTable
value="#{extendedTableBean.capitalsDataModel}" var=“cap” id=“table”
width=“580px” height=“400px”
sortMode="#{extendedTableBean.sortMode}"
selectionMode="#{extendedTableBean.selectionMode}"
tableState="#{extendedTableBean.tableState}"
selection="#{extendedTableBean.selection}">
<rich:column sortable=“false” label=“Flag”>
<f:facet name=“header”>
<h:outputText value=“Flag” />
</f:facet>
<h:graphicImage value="#{cap.stateFlag}" />
</rich:column>
<rich:column sortable=“true” sortBy="#{cap.state}"
filterBy="#{cap.state}" filterEvent=“onkeyup” width=“170px”
label=“State Name”>
<f:facet name=“header”>
<h:outputText value=“State Name” />
</f:facet>
<h:outputText value="#{cap.state}" />
</rich:column>
<rich:column sortable=“true” sortBy="#{cap.name}"
filterBy="#{cap.name}" filterEvent=“onkeyup” width=“170px”
label=“State Capital”>
<f:facet name=“header”>
<h:outputText value=“State Capital” />
</f:facet>
<h:outputText value="#{cap.name}" />
</rich:column>
<rich:column sortable=“false” label=“Time Zone”>
<f:facet name=“header”>
<h:outputText value=“Time Zone” />
</f:facet>
<h:outputText value="#{cap.timeZone}" />
</rich:column>
<a4j:support reRender=“selectiontable”
action="#{extendedTableBean.takeSelection}"
event=“onselectionchange” />
</rich:extendedDataTable>
<h:panelGroup layout=“block” style=“width:250px”>
rich:panel
<f:facet name=“header”>
<h:outputText value=“Sort/Selection modes changing” />
</f:facet>
<h:panelGrid columns=“2”>
<h:outputText value=“Sort Mode:” />
<h:selectOneMenu value="#{extendedTableBean.sortMode}">
<f:selectItem itemLabel=“Single” itemValue=“single” />
<f:selectItem itemLabel=“Multi” itemValue=“multi” />
<a4j:support event=“onchange” ajaxSingle=“true” reRender=“table” />
</h:selectOneMenu>
<h:outputText value=“Selection Mode:” />
<h:selectOneMenu value="#{extendedTableBean.selectionMode}">
<a4j:support ajaxSingle=“true” event=“onchange” reRender=“table” />
<f:selectItem itemLabel=“Single” itemValue=“single” />
<f:selectItem itemLabel=“Multi” itemValue=“multi” />
<f:selectItem itemLabel=“None” itemValue=“none” />
</h:selectOneMenu>
</h:panelGrid>
</rich:panel>
rich:panel
<f:facet name=“header”>
<h:outputText value=“Currently selected rows:” />
</f:facet>
<rich:dataTable value="#{extendedTableBean.selectedCapitals}"
var=“sel” id=“selectiontable”>
rich:column
<h:graphicImage value="#{sel.stateFlag}" />
</rich:column>
rich:column
<h:outputText value="#{sel.state}" />
</rich:column>
rich:column
<h:outputText value="#{sel.name}" />
</rich:column>
rich:column
<h:outputText value="#{sel.timeZone}" />
</rich:column>
</rich:dataTable>
</rich:panel>
</h:panelGroup>
</h:panelGrid>
</h:form>
</ui:composition>

[/code]

ninguem? :shock: :frowning:

por favor me ajudemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm!!!

:frowning:

tenta usar um metodo String com o retorno um link mapeado no xml