It works but the output is broken :)
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||
*/
|
||||
package beans;
|
||||
|
||||
import bl.DataFromDatabase;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.enterprise.context.SessionScoped;
|
||||
import jakarta.faces.application.ConfigurableNavigationHandler;
|
||||
import jakarta.faces.context.ExternalContext;
|
||||
import jakarta.faces.context.FacesContext;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.primefaces.event.SelectEvent;
|
||||
import pojos.Stock;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author asdv5
|
||||
*/
|
||||
@Named(value = "stockBean")
|
||||
@SessionScoped
|
||||
public class StockBean implements Serializable
|
||||
{
|
||||
@Inject
|
||||
DataFromDatabase dbData;
|
||||
List<Stock> stocks;
|
||||
|
||||
|
||||
@PostConstruct
|
||||
void init()
|
||||
{
|
||||
stocks = dbData.getList();
|
||||
}
|
||||
|
||||
public List<Stock> getStocks()
|
||||
{
|
||||
return stocks;
|
||||
}
|
||||
|
||||
public void setStocks(List<Stock> stocks)
|
||||
{
|
||||
this.stocks = stocks;
|
||||
}
|
||||
|
||||
|
||||
public void onRowSelect(SelectEvent event)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ExternalContext ec = fc.getExternalContext();
|
||||
Stock a = (Stock) event.getObject();
|
||||
String page = "client-page";
|
||||
String params = "&url_of_parent_param1=" + "index";
|
||||
params += "&stock_id_param2=" + a.getStockId();
|
||||
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) fc.getApplication().getNavigationHandler();
|
||||
handler.performNavigation(page + "?faces-redirect=true" + params);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user