import com.google.gwt.regexp.shared.RegExp; /** 获取用户设置的当前页码 */ public int getCurrentaBoxVal() { int pageNum = 1; String currentPageBoxVal = currentPageBox.getValue().trim(); String patternStr = "^\\d+$"; if (null != currentPageBoxVal && currentPageBoxVal.length() > 0) { RegExp regExp = RegExp.compile(patternStr); boolean matchFound = regExp.test(currentPageBoxVal); if (matchFound) { pageNum = Integer.valueOf(currentPageBoxVal); } else { Window.alert("Please input positive integer !"); } } else { pageNum = currentPageNumber; } return pageNum; }
.