Tôi muốn chuyển đổi chuỗi thành số nguyên trong JSF hLselectOneMenu.Cách chuyển đổi chuỗi thành số nguyên trong h: selectOneMenu
<h:selectOneMenu id="rowsPerPage" value="#{AccountsController.rowsPerPage}" converter="javax.faces.Integer" maxlength="3">
<f:selectItem itemValue="10" itemLabel="10" />
<f:selectItem itemValue="50" itemLabel="50" />
<f:selectItem itemValue="100" itemLabel="100" />
<f:selectItem itemValue="500" itemLabel="500" />
<f:selectItem itemValue="094332" itemLabel="Custom" />
<f:ajax render="customrowperpage" />
</h:selectOneMenu>
<h:inputText id="customrowperpage" value="#{AccountsController.rowsPerPage}" rendered="#{AccountsController.rowsPerPage == '094332'}" required="true" />
Làm cách nào tôi có thể thực hiện việc này trong trang JSF?
P.S Tôi đã cập nhật mã nhưng mã AJAX không hoạt động. Khi tôi chọn "tùy chỉnh", trường nhập sẽ không được hiển thị.
+1 cho thấy rằng không có thuộc tính kích thước trên h: selectOneMenu. Tôi chạy vào cùng một vấn đề này chuyển đổi h: inputText thành h: selectOneMenu. – Catfish