JSF commandLink与图像 [英] JSF commandLink with image

查看:72
本文介绍了JSF commandLink与图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对<p:commandLink>有问题.我想进行悬停效果,但是无法通过CSS将图像加载到<p:graphicImage>.

I have problem with <p:commandLink>. I want make hover effect but I can't load image to <p:graphicImage> via CSS.

CSS:

.accountEditBtn {
    background-image:
    url('#{request.contextPath}/resources/image/pencil_black.png');
}

JSF:

<p:commandLink
    update="@form"
    actionListener="#{someBean.someListener}">
    <h:graphicImage styleClass="accountEditBtn" />
</p:commandLink>

我看到带边框的空矩形.

I see empty rectangle with border.

但是当我向graphicImage添加alt时,我会从alt获取文本上的图像...

But when I add alt to graphicImage, I get image over text from alt...

我的错误在哪里? 谢谢你. p.s.键入错误-classType-> styleClass

Where my mistake? Thank you. p.s. typing error - classType -> styleClass

推荐答案

尝试使用styleClass代替<h:graphicImage>

try using styleClass instead of <h:graphicImage>

<p:commandLink 
   styleClass="accountEditBtn"
   update="@form"
   actionListener="#{someBean.someListener}"/>

尝试这个课程

.accountEditBtn { background-image: url('../resources/image/pencil_black.png'); }

B.T.W

不是图像吗?还是图片(文件夹名称)

isn't is should be images ? or it is image (folder name)

也要看一下这个..如果您想要带图像的commandButton: PrimeFaces图标

take a look at this as well.. in case you want commandButton with image: PrimeFaces icons

这篇关于JSF commandLink与图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆