首先,我将提供我的配置详细信息:
JSF - 1.2
Icefaces - 1.8
Servlet - 2.5
我正在尝试将一个放入ice:selectBooleanCheckbox
数据表中。但是,我反复面临一个例外:
icelogin.jspx @54,59 value="#{o.checkBox}":ELResolver 无法处理标识符为 'o' 的空基础对象
这是我的jspx代码
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:ft="http://facestrace.sourceforge.net">
<f:view>
<head>
<title>JSF Jump start</title>
</head>
<body>
<ice:form>
<h3>User Name and Password</h3>
<table>
<tr>
<td>
<ice:outputLabel value="Name"/>
</td>
<td>
<ice:inputText value="#{userLogin.name}"/>
</td>
</tr>
<tr>
<td>
<ice:outputLabel value="Password"/>
</td>
<td>
<ice:inputText value="#{userLogin.password}"/>
</td>
</tr>
</table>
<ice:dataTable value="#{userLogin.orderList}" var="o">
<ice:column>
<!-- column header -->
<f:facet name="header">Order No</f:facet>
<!-- row record -->
#{o.orderNo}
</ice:column>
<ice:column>
<f:facet name="header">Product Name</f:facet>
#{o.productName}
</ice:column>
<ice:column>
<f:facet name="header">Price</f:facet>
#{o.price}
</ice:column>
<ice:column>
<!-- column header -->
<f:facet name="header">Checkbox</f:facet>
<!-- row record -->
<ice:selectBooleanCheckbox value="#{o.checkBox}"/>
<!-- #{o.checkBox} -->
</ice:column>
<ice:column>
<f:facet name="header">Quantity</f:facet>
#{o.qty}
</ice:column>
</ice:dataTable>
<ice:commandButton type="submit" value="Sign In" action="#userLogin.saveData}"/>
</ice:form>
</body>
</f:view>
</html>
如果我将 checkBox 值从 #{o.checkBox} 删除为真或假,它会起作用。我认为如果为真,则应在 UI 中选择复选框,而如果为假,则必须保持未选中状态。但是,即使我把这样的代码
<ice:selectBooleanCheckbox value="true"/>
检查按钮显示在 UI 中,但未显示为选中状态,尽管值为 true。我正在关注本教程,就我而言,我的 bean 中还有一个额外的参数。
boolean checkBox;
我有 getter 和 setter,并传递给构造函数,所有设置。有什么问题?