i try to translate following working jsf code into java code
JSF:
<rich:suggestionbox height="" for="t1" id="sugg1" width="" var="var" immediate="true" suggestionAction="#{Page.suggest}"> <a4j:support event="onsubmit" ajaxSingle="true"> <a4j:actionparam id="param1" value="abc" assignTo="#{Page.suggestid}"/> </a4j:support> <rich:column> <h:outputText value="#{var.value}" /> </rich:column> </rich:suggestionbox>
HtmlSuggestionBox suggest = new HtmlSuggestionBox(); ... HtmlActionParameter myActionParameter = new HtmlActionParameter(); myActionParameter.setValue("abc"); myActionParameter.setId("P42"); log.debug("set assgin to"); FacesContext context = FacesContext.getCurrentInstance(); javax.faces.application.Application application = context .getApplication(); javax.el.ExpressionFactory ef = application.getExpressionFactory(); javax.el.ValueExpression ve = ef.createValueExpression(context .getELContext(), "#{Page.suggestid}", String.class); myActionParameter.setAssignToBinding( ve); HtmlAjaxSupport ajaxSupport = new HtmlAjaxSupport(); ajaxSupport.setEvent("onsubmit"); ajaxSupport.setAjaxSingle(true); ajaxSupport.setId(getID("a4jsupport")); myActionParameter.setParent(ajaxSupport); suggest.getFacets().put( ajaxSupport.getId(), ajaxSupport);