jsf 传值的问题
我是目的是要在页面通过<h:commandButton >把一个值0传到我的类里面。
页面中设置:
<h:form>
<h:inputHidden value="0" binding="#{paginationBean.startIndex}" >
<h:commandButton action="#{userBean.query}" type="submit" value="查询">
</h:form>
UserBean.java中:
FacesContext context = FacesContext.getCurrentInstance();
PaginationBean bean =(PaginationBean)context.getApplication().getELResolver().getValue(context.getELContext(), null, "paginationBean");
bean.getStartIndex();
System.out.println("1111111111111111113" + bean.getStartIndex());
PaginationBean.java中
@Name("paginationBean")
@Scope(ScopeType.PAGE)
public class PaginationBean<T extends PagedListBean> {
protected int startIndex = 0;
}
结果是接受不到,xhtml中<h:inputHidden value="0" binding="#{paginationBean.startIndex}" >不知道对不对,报页面错误
<h:inputHidden value="#{paginationBean.startIndex}" >这样就没有页面错误了,但是没办法接受我的0这个值。
我觉得<h:inputHidden >和<h:inputText>应该差不多。<h:inputText>可以通过手动输入,可是<h:inputHidden >该把这个值放在哪呢?