1

我有一个问题 selectedArticleGroup 总是NULL!!!

这是我的课程:

                <p:selectOneMenu id="categorie_article"
                    value="#{articleGroupListController.selectedArticleGroup}"
                    effect="fade" converter="omnifaces.SelectItemsConverter"
                    filter="true" filterMatchMode="startsWith">
                    <f:selectItem itemLabel="Select One" noSelectionOption="true" />
                    <f:selectItems
                        value="#{articleGroupListController.articleListGroup}"
                        var="articleListGroup" itemLabel="#{articleListGroup.name}" itemValue="#{articleListGroup}"  />
                    <f:ajax render="selected_item" />
                </p:selectOneMenu>

豆子:

    @SessionScoped
    @Named
    public class ArticleGroupListController implements Serializable {
    ....
        private ArticleGroup selectedArticleGroup;
......GETTER + SETTER

转换器的实现在omnifaces jar 中。

问题是:articleGroupListController.selectedArticleGroup 始终为空。有人可以帮我吗?


在此代码中,如果您单击图像,确认框会询问您是否要删除图像。

如果您接受,则将其从 DOM 中删除。

在两行之间复制 addEventListener//your code

thumb.setAttribute('src',e.target.result);// your code

thumb.addEventListener('click',function(){
 if(confirm('delete?')){
  this.parentNode.removeChild(this)
 }
},false);

document.getElementById('images_preview').appendChild(thumb); // your code

如果您不需要为其他目的选择图像,这是最快的方法。

您还可以使用 (this) 直接与图像交互;

要创建一个漂亮的按钮效果,我只需在悬停时添加 css 样式。

#images_preview>img:hover:after{
 //here u add a nice delete icon
}

如果您需要更多按钮并且可以选择每个图像,我会将图像作为背景放在左侧浮动 div 中,并在 div 内放置您需要的不同按钮。

4

0 回答 0