如何使wicket链接显示为图像? [英] How to make a wicket link appear as an image?

查看:96
本文介绍了如何使wicket链接显示为图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将wicket链接显示为图像而不是文本。我正在创建一个外部链接,然后将其放在页面上。

I am trying to make a wicket link appear as an image instead of text. I am creating an external link and then placing it on the page.

add(new ExternalLink("link", url, "Page name"));
<a wicket:id="link"></a>

我的问题是我不能把图像放在页面名称的位置,因为它会只需将html设置为文本即可。我也试图跨越一个wicket id,它也被渲染为文本。任何人都可以帮忙吗?

My problem is that I can't put the image in place of "Page name" because it will just set the html as text. I also tried to span a wicket id instead and it also is rendered as text. Can anyone help?

推荐答案

对于静态图片:

<a wicket:id="link"><img src="myImg.jpg" alt="My Image" /></a>
add(new ExternalLink("link", url));

或者对于动态图像,将图像添加到ExternalLink

Or for a dynamic image add the image to the ExternalLink

这篇关于如何使wicket链接显示为图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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