Primefaces SelectOneMenu 不在 AIX 上发送选定的值

Primefaces SelectOneMenu not sending selected value on AIX

我有一个使用 PrimeFaces 的应用程序,它是在 Windows 上使用 WebSphere 服务器开发的。

当我尝试在 IBM AIX 上 运行 它时,所有 SelectOneMenu 都无法正常工作。所选值不会发送到 bean 并在提交表单时重置为默认值。没有 Java 脚本错误,控制台也没有 Java 错误。

我使用 PrimeFaces 5.2 和 Websphere 服务器 8.5.5。我在 Google Chrome 和 Internet Explorer 11 中测试了该应用程序。

我有一个 SelectOneMenu 的例子(正在 Windows):

<p:selectOneMenu id="selectType" 
    required="true"
    value="#{exampleBean.newExample.exampleType}"
    widgetVar="selectExampleType">

    <f:selectItem itemLabel="exampleType"
        itemValue="#{null}" 
        noSelectionOption="true" />

    <f:selectItems value="#{exampleBean.exampleTypeList}"
        var="exampleType" 
        itemLabel="#{exampleType.getCurrentDescription()}"
        itemValue="#{exampleType}" />

</p:selectOneMenu>

终于找到问题了。这是当我覆盖某个对象上的 getAsString 方法并使用这行代码在字符串之间添加 space 时:

System.getProperty("line.separator")

AIX 似乎没有将此行解释为 space(我不知道为什么)所以我不得不用引号之间的简单 space 替换它,如下所示:

" "

如果有人能解释为什么会这样,那就太好了。纯属幸运,我发现这是诚实的。