0
私は検索テキストを持っているので、同じページの入力テキストを検索する必要があります.ctrl + fでWebページを検索するのと同じように、入力テキストのすべての出現をjsf + icefaces 。私のXHTMLは、私はそう問題jsfで行ごとにデータテーブルのテキストを検索するにはどうすればよいですか?
を解決する方法を知っているJSFに新しいいけないのです、私はこれをやってますが、NullPointerExceptionが発生public void searchButton(ActionEvent e) {
searchTextField = editSplitAsgnsBean.getSearchTextField();
if(isNullOrEmpty(searchTextField)) { return; }
if(!validateInput(searchTextField, true, 10)){
popupHandler.displayMessage(getMessageString(EDIT_SPLIT_ASSIGNMENT_SEARCHSTRING_VALIDATION_MESSAGE));
return;
}
resetSearchData();
findMatchedColumn(SEARCH);
}
public void nextButton(ActionEvent e) {
findMatchedColumn(NEXT);
}
private void findMatchedColumn(String action) {
EditSplitAsgnsData searchRow = null;
String search = editSplitAsgnsBean.getSearchTextField();
if (NEXT.equals(action) && lastFoundIndex != -1) {
index++;
if (matchedColumns.size() > index) {
selectColumn = matchedColumns.get(index);
selectCell(getTable(), lastFoundIndex, selectColumn);
return;
}
}
int newFoundIndex = getTable().findRow(search, selectedColumns, lastFoundIndex + 1, DataTable.SearchType.CONTAINS, true);
matchedColumns.clear();
index = 0;
if (SEARCH.equals(action) && newFoundIndex == -1) {
popupHandler.displayMessage(getMessageString(COMMON_NOSORTSCHEME_DATA_MSG, search));
return;
}
if (NEXT.equals(action) && newFoundIndex == -1) {
popupHandler.displayMessage(getMessageString(EDIT_SPLIT_ASSIGNMENT_SEARCHSTRING_VALIDATION_MESSAGE, search));
searchFlag = false;
selectCell(getTable(), lastFoundIndex, selectColumn);
return;
}
searchFlag = true;
getTable().navigateToRow(newFoundIndex);
getTable().setRowIndex(newFoundIndex);
searchRow = (EditSplitAsgnsData) getTable().getRowData();
searchMatches(searchRow, search);
if (!CollectionsUtil.isNullOrEmpty(matchedColumns)) {
selectColumn = matchedColumns.get(index);
}
lastFoundIndex = newFoundIndex;
selectCell(getTable(), lastFoundIndex, selectColumn);
}
private void resetSearchData() {
lastFoundIndex = -1;
selectColumn = -1;
searchFlag = false;
}
スタックトレース
java.lang.NullPointerException
at com.fedex.emea.gss.controller.EditSplitAsgnsController.findMatchedColumn(EditSplitAsgnsController.java:483)
at com.fedex.emea.gss.controller.EditSplitAsgnsController.searchButton(EditSplitAsgnsController.java:464)
at com.fedex.emea.gss.controller.EditSplitAsgnsController$$FastClassByCGLIB$$6f1285ca.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
at com.fedex.emea.gss.controller.EditSplitAsgnsController$$EnhancerByCGLIB$$6e6697f4.searchButton(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.el.parser.AstValue.invoke(AstValue.java:278)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:775)
at javax.faces.component.UICommand.broadcast(UICommand.java:300)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1251)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
を取得しています、私のコントローラで
<h:inputText id="searchTextField" size="12" maxlength="10" value="#{editSplitAsgnsBean.searchTextField}">
</h:inputText>
<ice:commandButton styleClass="buttonPurple" value="#{msgs['EditSplitAsgns.Button.searchButton']}" id="searchButton"
actionListener="#{editSplitAsgnsController.searchButton}">
<ace:ajax execute="@this" render="@sortDataTable" />
</ice:commandButton>
です
お返事ありがとうございました。私はあなたから提供されたソリューションをお試しいただきます。 – subhashis