Suggestion component using
suggestionDemo.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j" xmlns:s="http://richfaces.org/s">
<h:form id="form1">
<s:div>this is a suggestionBox example
<br />
input code: pref like X or 1,2,3;
<br />
input name: pref like ;
</s:div>
<br />
<h:panelGrid columns="4">
<h:outputText value="Code:" />
<h:inputText value="" id="codeId" />
<h:outputText value="Name:" />
<h:inputText value="" id="nameId" />
</h:panelGrid>
<ui:include src="/common/suggestTemplate.xhtml">
<ui:param name="height" value="150" />
<ui:param name="width" value="150" />
<ui:param name="renderedCodeId" value="codeId" />
<ui:param name="renderedNameId" value="nameId" />
<ui:param name="filedCode" value="CODE_ID" />
<ui:param name="filedName" value="DESC_C" />
<ui:param name="tableName" value="SC_CODE" />
<ui:param name="showCode" value="#{rich:element('codeId')}" />
<ui:param name="showName" value="#{rich:element('nameId')}" />
<ui:param name="autoCompleteAction" value="#{suggestAction}" />
</ui:include>
</h:form>
</ui:composition>
suggestTemplate.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
<h:panelGroup>
<!-- select name show code -->
<h:inputHidden value="#{filedCode}" binding="#{autoCompleteAction.filedCode}"/>
<h:inputHidden value="#{filedName}" binding="#{autoCompleteAction.filedName}"/>
<h:inputHidden value="#{tableName}" binding="#{autoCompleteAction.tableName}"/>
<rich:suggestionbox height="#{height}" width="#{width}" var="_result"
for="#{renderedCodeId}" id="suggestion"
suggestionAction="#{autoCompleteAction.autocomplete}"
nothingLabel="No data found" fetchValue="#{_result.showCode}"
usingSuggestObjects="true" limitToList="true" bypassUpdates="true"
onobjectchange="#{showName}.value= #{rich:component('suggestion')}.getSelectedItems().pluck('showName')">
<h:column>
<h:outputLabel value="#{_result.showCode}"/>
</h:column>
<h:column>
<h:outputLabel value="#{_result.showName}" />
</h:column>
</rich:suggestionbox>
<!-- select data show name -->
<rich:suggestionbox height="#{height}" width="#{width}" var="_result"
for="#{renderedNameId}" id="suggestion_name"
suggestionAction="#{autoCompleteAction.autocomplete}"
nothingLabel="No data found" fetchValue="#{_result.showName}"
usingSuggestObjects="true" limitToList="true" bypassUpdates="true"
onobjectchange="#{showCode}.value= #{rich:component('suggestion_name')}.getSelectedItems().pluck('showCode')">
<h:column>
<h:outputLabel value="#{_result.showCode} " />
</h:column>
<h:column>
<h:outputLabel value="#{_result.showName}" />
</h:column>
</rich:suggestionbox>
</h:panelGroup>
</ui:composition>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Is Eclipse IDE dying?In 2014 the Eclipse IDE is the leading development environment for Java with a market share of approximately 65%. but ac...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.