Pourquoi je n arrive pas à récuperer la ligne active de mon data table
Bonjour Mon EB:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| package ms.marchandise.com;
import java.util.List;
import javax.faces.model.DataModel;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.marinesoft.DAO.PaysDao;
import com.marinesoft.donnee.Pays;
public class EBPays {
private List<Pays> Pays;
private DataModel PaysDataModel;
private String Selection;
//METHODE POUR RECUPERER UNE LISTE DE PAYS
public List<Pays> getPays() {
try {
Context context = new InitialContext();
PaysDao pa = (PaysDao) context.lookup("PaysDaoJpa/remote");
Pays = pa.findAll();
} catch (NamingException e) {
e.printStackTrace();
}
return Pays;
}
public String getSelection() {
PaysDataModel.setWrappedData(Pays);
this.Selection= (String) PaysDataModel.getRowData();
return Selection;
}
public void setSelection(String selection) {
Selection = selection;
}
} |
Ma page JSP:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:form>
<rich:dataTable onRowMouseOver="this.style.backgroundColor='#F1F1F1'" onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
id="table" rows="7" value="#{eBPays.pays}" var="P" rowKeyVar="row" style="width : 248px; height : 163px;">
<f:facet name="header">
<h:outputText value="Liste de Recherche"/>
</f:facet>
<rich:column>
<f:facet name="header"><h:outputText value="Code"/></f:facet>
<h:outputText value="#{P.code}"/>
</rich:column>
<rich:column>
<f:facet name="header"><h:outputText value="Libelle"/></f:facet>
<h:outputText value="#{P.libelle}"/>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Actions"></h:outputText>
</f:facet>
<a4j:commandLink ajaxSingle="true" id="editlink"
oncomplete="#{rich:component('editPanel')}.show()">
<h:graphicImage value="/image/edit.gif" style="border:0"/>
<f:setPropertyActionListener value="#{row}"
target="#{eBPays.selection}" />
</a4j:commandLink>
<rich:toolTip for="editlink" value="Edit"/>
</rich:column>
</rich:dataTable>
<rich:datascroller for="table" maxPages="3" style="height : 20px; width : 248px;"></rich:datascroller>
<rich:modalPanel id="editPanel" autosized="true" width="450">
<f:facet name="header">
<h:outputText value="Editer Pays" />
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="/image/close.png"
id="hidelink" styleClass="hidelink"/>
<rich:componentControl for="editPanel" attachTo="hidelink"
operation="hide" event="onclick" />
</h:panelGroup>
</f:facet>
<h:form>
<rich:messages style="color:red;"></rich:messages>
<h:panelGrid columns="1">
<a4j:outputPanel ajaxRendered="true">
<h:panelGrid columns="2">
<h:outputText value="Code"/>
<h:inputText id="PanelCode" value="#{eBPays.selection.code}"/>
<h:outputText value="Libelle" />
<h:inputText id="PanelLibelle" value="#{eBPays.selection.libelle}" />
</h:panelGrid>
</a4j:outputPanel>
<a4j:commandButton value="Store"
oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editPanel')}.hide();" />
</h:panelGrid>
</h:form>
</rich:modalPanel>
</h:form>
</f:view>
</body>
</html> |
je me base sur la faq et jboss rich faces mais sa ne marche pas pourquoi quel est le type avec le quel je dois remplir ma data table
que est le type de la ligne selectionner avec getrow
comment je peut exploiter cela au niveau d'un masque
AIDEZ MOI SVP J essai de régler ce problème mais je n y arrive pas toute seul
je remercie d avance tout ceux qui vont m aider