|
MyEclipse 下开发JSF教程(7) * Get the session map of the external context */ Map session = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
/* * Find the UIParameter component by eXPression */ UIParameter component = (UIParameter) event.getComponent().findComponent("deleteId");
/* * parse the value of the UIParameter component */ long id = Long.parseLong(component.getValue().toString());
/* * delete the book by id */ simulateDB.deleteBookById(id, session); }
The file faces-config.XMLThe faces-config.XML is the central configuration file of JavaServer faces. In this file you define the workflow of the application (on which action which site will be processed) , the managed bean classes by JSF and something more. The workflow of the library application looks like the following. Java/国外教程下载/LaLiLuna%20-%20Tutorials%20for%20struts,%20ejb,%20myeclipse%20»%20First%20Java%20Server%20Faces%20Tutorial.files/workflow.gif" width=400 align=left border=0 name=Graphic7>
We define a navigation rule for this workflow. Open the file faces-config.XML and add the following configuration. <faces-config>
|