使用 Tapestry 4.0.1 在 @For 循环中显示 javascript/css 工具提示

发布于 2024-07-30 10:05:15 字数 214 浏览 1 评论 0原文

我对 Tapestry 4.0.1 一点也不熟悉,需要更新旧应用程序以显示 @For 循环中一些链接的格式化工具提示。 实现这一目标的最简单/最好的方法是什么? 我应该使用 @Script 组件还是有更简单的方法?

顺便说一下,升级到更新版本的 Tapestry 是不可能的。 不幸的是,是的,但这是我无法控制的。

在此先感谢您的帮助。

卡尔

I'm not at all familiar with Tapestry 4.0.1 and need to update a legacy application to display a formatted tooltip for a few links within a @For loop. What is the easiest/best way to go about accomplishing this? Should I be using the @Script component or is there a simpler way?

By the way, upgrading to a newer version of Tapestry is out of the question. Unfortunate, yes, but out of my control.

Thanks in advance for your help.

Carl

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

奈何桥上唱咆哮 2024-08-06 10:05:15

在发布我的问题后,我设法想出了一个相当老套(蹩脚?)的解决方案。 不能说这是我作为一名工程师最自豪的时刻,但它确实有效。*

<script type="text/javascript">
    function outputLink(value, tooltip) {
            document.write("<a href='#' onclick='return false;' onmouseover='showtip(event, \"" + tooltip + "\");' onmouseout='hidetip();'>" + value + "</a>");
        }
</script>
<span jwcid='@For'>
    <script type="text/javascript">
        outputLink("Foo", "<span jwcid="@Insert" value="ognl:foo.bar"/>");
    </script>
</span>

*为了保护无辜者而省略了一些代码。

After posting my question, I managed to come up with a rather hacky (crappy?) solution. Can't say it's my proudest moment as a engineer, but it works.*

<script type="text/javascript">
    function outputLink(value, tooltip) {
            document.write("<a href='#' onclick='return false;' onmouseover='showtip(event, \"" + tooltip + "\");' onmouseout='hidetip();'>" + value + "</a>");
        }
</script>
<span jwcid='@For'>
    <script type="text/javascript">
        outputLink("Foo", "<span jwcid="@Insert" value="ognl:foo.bar"/>");
    </script>
</span>

*Some code omitted to protect the innocent.

错爱 2024-08-06 10:05:15

使用@Any组件。 对于您的示例,将 MYTOOLTIP 替换为保存消息的任何对象:

<a jwcid="@Any" id="adUnitPredicate" href="#" onclick="return false;" onmouseover="ognl:'showtip(event, \'' + MYTOOLTIP + '\');'" onmouseout="hidetip();">AdUnit Predicate</a>

Use the @Any component. For your example, substitute MYTOOLTIP with whatever object is holding the message:

<a jwcid="@Any" id="adUnitPredicate" href="#" onclick="return false;" onmouseover="ognl:'showtip(event, \'' + MYTOOLTIP + '\');'" onmouseout="hidetip();">AdUnit Predicate</a>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文