我有一个包含多个列+的adf表,加上一个有按钮的列,它将打开一个弹出窗口来插入一个值。
<af:table value="#{bindings.BpmCrMilestoneUPView1.collectionModel}" var="row" rows="#{bindings.BpmCrMilestoneUPView1.rangeSize}" >
<af:column id="c49" headerText="#{bindings.BpmCrMilestoneUPView1.hints.MilestoneSeq.label}" width="50" displayIndex="-1" minimumWidth="12">
<af:inputText value="#{row.bindings.MilestoneSeq.inputValue}" readOnly="true" id="it16">
</af:inputText>
</af:column>
<af:column>
<af:inputText value="#{row.bindings.Oldmilesseq.inputValue}" id="it15">
</af:column>
<af:column label="openPopUp" >
<af:button action = "#{pageFlowScope.CRInitaitiveBean.openCommentsPopUp}" >
</af:button>
</af:column>
<af:table>这是包含输入文本字段的弹出窗口
<af:popup binding="#{pageFlowScope.CRInitaitiveBean.commentsPopUp}" id="p2">
<div class="form-group" id="d7">
<af:outputLabel value="#{lang.previous_comments}" />
<af:inputText autoSubmit="true" simple="true"
value="#{bindings.newCommentValue.inputValue}" />
</div>
</div>和指向绑定选项卡中的newCommentValue的BpmCrOutputUPView1Iterator。如果打开每一行的弹出并键入值,则所有值都将正确保存。
但是,当我尝试以编程方式循环迭代器时,类型化值为空。
这是密码
RowSetIterator itr = ADFUtils.findIterator("BpmCrOutputUPView1Iterator").getRowSetIterator();
while (itr.hasNext()) {
Row row = itr.next();
if (row != null) {
System.out.println();
System.out.println("Current OUTPUT Row Is Not Null");
String newComment = (String) row.getAttribute("newCommentValue");
System.out.println();
System.out.println("new Comment is -------------------> "+newComment); // it should print the typed value for that row
but it's printed null 发布于 2019-03-15 07:40:00
对于这个特定的用例来说,使用强烈推荐的resolveExpression开放源码类JSFUtils函数会更容易。
JSFUtils和ADFUtils是由3位ADF英雄邓肯·米尔斯、史蒂夫·门奇和里克·史密斯创造的两个实用的java类。你可以很容易地找到那些使用你最喜欢的搜索引擎。
一旦添加到项目中,您就可以获得Java 中EL表达式的值,如下所示:
String newCommentValue= (String)JSFUtils.resolveExpression("#{bindings.newCommentValue.inputValue}");下面是您的信息的JSFUtils函数:
/**
* Method for taking a reference to a JSF binding expression and returning
* the matching object (or creating it).
* @param expression EL expression
* @return Managed object
*/
public static Object resolveExpression(String expression) {
FacesContext facesContext = getFacesContext();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
ValueExpression valueExp = elFactory.createValueExpression(elContext, expression, Object.class);
return valueExp.getValue(elContext);
}https://stackoverflow.com/questions/55170360
复制相似问题