【问题标题】:Error when submit a <p:pickList> with <p:inputText> column提交带有 <p:inputText> 列的 <p:pickList> 时出错
【发布时间】:2023-03-11 02:26:01
【问题描述】:

我需要带有可编辑列的pickList,我不确定是否可能。

选择列表:

<p:pickList value="#{model.formatList}" 
    var="format" 
    itemValue="#{format.formatName}"          
    converter="formatConverter">
    <p:column>
        <h:outputText value="#{format.formatMess}" />
    </p:column>
    <p:column>
        <p:inputText value="#{format.width}" />
    </p:column>
</p:pickList>

在我的Backing Bean中,formatList中的所有字段都有getter&setter。 当我提交表单时,控制台中会显示一些错误消息: [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-0.0.0.0-0.0.0.0-8080- 1)/page/lookup/lookupFormatEdit.xhtml @91,45 value="#{format.width}" : Target Unreachable, identifier 'format' resolved to null: javax.el.PropertyNotFoundException ...

但如果我将&lt;p:inputText value="#{format.width}" /&gt; 替换为&lt;h:outputText value="#{format.width}" /&gt;,它会起作用。

任何人都可以给我一些建议,谢谢。

【问题讨论】:

  • 虽然不行,但我想知道为什么会出现这个错误
  • 你能贴出你的backing bean的代码吗?页面好像找不到bean
  • 我找到了一种方法来代替:在提交之前,我使用javascript将picklist数据制作为JSON格式,然后backing bean可以获取JSON值来更新模型。感谢您的帮助。跨度>

标签: jsf-2 primefaces


【解决方案1】:

&lt;p:pickList&gt; 只是一个供您选择的列表。我认为你不能在&lt;p:pickList&gt; 中拥有&lt;p:inputText&gt;。我认为你应该使用&lt;p:dataTable&gt; 来代替多行选择。然后您可以将&lt;p:inputText&gt; 放在其中的一列中。

【讨论】:

  • 是的 可以,但不适合我的情况。非常感谢。
【解决方案2】:

使用

p:inplace

primefaces 的标签。

它肯定会起作用。

【讨论】:

    猜你喜欢
    • 2014-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-09
    • 1970-01-01
    • 1970-01-01
    • 2015-11-16
    • 1970-01-01
    相关资源
    最近更新 更多