小编Nei*_*eil的帖子

cellEditor中的commandLink不会触发action/actionListener

我正在使用Primefaces 3.4和JSF 2.0.我有ap:commandLink:

<p:commandLink action="#{wizard.onRemoveFoodItem}" update="@(#ingredientListContent)" immediate="true">
    <span class="ui-icon ui-icon-close"></span>
    <f:setPropertyActionListener target="#{wizard.selectedFoodItem}" value="#{foodItem}" />
</p:commandLink> 
Run Code Online (Sandbox Code Playgroud)

它的目的是为了从食物在我的P A名单中删除行:DataTable,并将它的工作原理在正常情况下.问题在于我想在同一个位置也有ap:rowEditor,对于那些熟悉primefaces rowEditor的人来说,在编辑时,你可以看到一个检查和一个x图标(用于结束编辑模式)而且我不希望有两个关闭图标,其中一个含义取消编辑模式,另一个删除当前行.

所以我决定将它嵌入到ap:cellEditor中,以便在编辑期间隐藏删除行的"x":

<p:cellEditor>   
    <f:facet name="output">  
        <p:commandLink action="#{wizard.onRemoveFoodItem}" update="@(#ingredientListContent)" immediate="true">
            <span class="ui-icon ui-icon-close"></span>
            <f:setPropertyActionListener target="#{wizard.selectedFoodItem}" value="#{foodItem}" />
        </p:commandLink> 
    </f:facet>  
    <f:facet name="input"><h:outputText value="" /></f:facet>                       
</p:cellEditor> 
Run Code Online (Sandbox Code Playgroud)

这奇怪地发送一个ajax请求并获得更新响应(没有明显的验证错误),但是它没有调用onRemoveFoodItem上的action方法,就像它不在p:cellEditor标签内时那样.我理解p:cellEditor并不是真的意味着以这种方式使用,但我认为当它可见时,它会表现得好像没有p:cellEditor围绕它.

任何人都可以在这里看到任何明显错误的东西,或者这是一个问题与primefaces?我将不胜感激任何帮助.

java primefaces jsf-2

4
推荐指数
1
解决办法
1019
查看次数

Java - 未选中从Object转换为Map.Entry <String,String>

我在"Map.Entry entry =(Entry)o;"上有一个"从Object到Map.Entry的未经检查的强制转换".

我认为一切正常,我可以安全地添加抑制警告,但我不确定.这是我的代码.

public abstract class WebPath {
    protected Hashtable<String, String> wp;

    public String get(String whatDoYouWant) {
        for (Object o : wp.entrySet()) {

            Map.Entry<String, String> entry = (Entry<String, String>) o;
            if (whatDoYouWant.equals(entry.getKey())) {
                return (String) entry.getValue();
            }
        }

        return null;
    }
}
Run Code Online (Sandbox Code Playgroud)

谢谢大家,祝你有个美好的一天!

java casting hashtable

3
推荐指数
2
解决办法
3324
查看次数

如何使用bruteforce方法列表元素的可能组合?

如何列出所有可能的组合:

字符串(4个字符,只有小写字母没有数字或特殊符号),#符号,字符串(5个字符,与第1个相同的rue).

例如:

dhgi#msodd

php algorithm brute-force

0
推荐指数
1
解决办法
1112
查看次数

标签 统计

java ×2

algorithm ×1

brute-force ×1

casting ×1

hashtable ×1

jsf-2 ×1

php ×1

primefaces ×1