i tried to use primeface 5.1 "Dialog Framework - Data"(http://www.primefaces.org/showcase/ui/df/data.xhtml) example in my computer but it doesn't work i can't find out what is the problem here because i didn't add anything new and i only did copy codes from example and past it. im using jboss 6.2 EAP as my server and jsf 2.1.21.
data.xhtml
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form>
<p:growl id="growl" showDetail="true" />
<p:commandButton value="Select Car" icon="ui-icon-extlink" actionListener="#{dfView.chooseCar}">
<p:ajax event="dialogReturn" listener="#{dfView.onCarChosen}" update="growl" />
</p:commandButton>
</h:form>
</h:body>
</html>
Code: Select all
import javax.faces.bean.ManagedBean;
import org.primefaces.context.RequestContext;
import org.primefaces.event.SelectEvent;
@ManagedBean(name = "dfView")
public class DFView {
public void chooseCar() {
RequestContext.getCurrentInstance().openDialog("selectCar");
}
public void onCarChosen(SelectEvent event) {
// Car car = (Car) event.getObject();
// FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Car Selected", "Id:" + car.getId());
//
// FacesContext.getCurrentInstance().addMessage(null, message);
}
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Cars</title>
<style type="text/css">
.ui-widget {
font-size: 90%;
}
</style>
</h:head>
<h:body>
<h:form>
<p:dataTable var="car" value="#{dfCarsView.cars}">
<p:column headerText="Id">
<h:outputText value="#{dfCarsView.cars}" />
</p:column>
<p:column headerText="Year">
<h:outputText value="#{dfCarsView.cars[1]}" />
</p:column>
<p:column headerText="Brand">
<h:outputText value="#{dfCarsView.cars[2]}" />
</p:column>
<p:column headerText="Color">
<h:outputText value="#{dfCarsView.cars[3]}" />
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
Code: Select all
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
@ManagedBean(name = "dfCarsView")
@ViewScoped
public class DFCarsView implements Serializable {
private List<String[]> cars;
// @ManagedProperty("#{carService}")
//private CarService service;
@PostConstruct
public void init() {
cars = new ArrayList<String[]>();
String c[] = {"A","B","C","D"};
cars.add(c);
}
public List<String[]> getCars() {
return cars;
}
public void setCars(List<String[]> cars) {
this.cars = cars;
}
// public void selectCarFromDialog(Car car) {
// RequestContext.getCurrentInstance().closeDialog(car);
// }
}
thanks and best regaurds