Portal Showcase
portal:inputSearch
InputSearch is a UIInput component that renders a text field and optional button for submitting search criteria.Instant Ajax Usage
The component supports instant Ajax by simply adding an f:ajax child tag. The default event for f:ajax event attribute issearch
(when the search button is clicked).
ソースコード
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:portal="http://liferay.com/faces/portal"> <h:form> <h:messages id="feedback" globalOnly="true" layout="table" /> <portal:inputSearch actionListener="#{inputSearchBacking.searchActionListener}" value="#{inputSearchBacking.searchText}"> <f:ajax render="feedback :modelValue" /> </portal:inputSearch> </h:form> <h:outputText value="#{inputSearchBacking.searchText}" id="modelValue" /> </ui:composition>
@ManagedBean @RequestScoped public class InputSearchBacking { private static final Logger logger = LoggerFactory.getLogger(InputSearchBacking.class); private String searchText; public String getSearchText() { return searchText; } public void searchActionListener(ActionEvent actionEvent) { FacesContext facesContext = FacesContext.getCurrentInstance(); PhaseId phaseId = facesContext.getCurrentPhaseId(); logger.debug("searchActionListener: phaseId=[{0}]", phaseId.toString()); String phaseName = phaseId.toString(); FacesMessage facesMessage = new FacesMessage("The searchActionListener method was called during the " + phaseName + " phase of the JSF lifecycle."); facesContext.addMessage(null, facesMessage); } public void setSearchText(String searchText) { this.searchText = searchText; } }
Liferay Faces Bridge Implementation 5.0.0 + Liferay Faces Portal 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20