Portal Showcase
portal:inputSearch
InputSearch is a UIInput component that renders a text field and optional button for submitting search criteria.Nav Bar Usage
When specified as a grand-child of portal:navBar and a child of portal:navBarSearch, the responsive layout feature for small/mobile displays causes the text field to appear in a popup menu.Lähdekoodi
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:portal="http://liferay.com/faces/portal" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> <h:form> <h:messages globalOnly="true" layout="table" /> <portal:navBar> <portal:navBarSearch styleClass="pull-right"> <portal:inputSearch value="#{inputSearchBacking.searchText}" actionListener="#{inputSearchBacking.searchActionListener}" buttonLabel="#{i18n['search']}" placeholder="#{i18n['enter-your-search-here']}" /> </portal:navBarSearch> </portal:navBar> </h:form> <h:outputText id="modelValue" value="#{inputSearchBacking.searchText}" /> </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