Java Alt标记不适用于动态图像标记

Java Alt标记不适用于动态图像标记,java,html,jsp,jstl,web-deployment,Java,Html,Jsp,Jstl,Web Deployment,我使用动态图像。这意味着在图像标记内部,我使用src的动态链接和alt的动态文本。对于src,它工作正常,但在alt中,我没有得到文本。下面是我的img标记的示例 <img style="top: 0px !important;" data-frame="<%=thumb%>" src="<%=image%>" alt="<%= advertiseObj.getAdTitle() %>" /> “alt=”“/> 现在问题解决了。由于javasc

我使用动态图像。这意味着在图像标记内部,我使用src的动态链接和alt的动态文本。对于src,它工作正常,但在alt中,我没有得到文本。下面是我的img标记的示例

<img style="top: 0px !important;" data-frame="<%=thumb%>" src="<%=image%>" alt="<%= advertiseObj.getAdTitle() %>" />
“alt=”“/>

现在问题解决了。由于javascript效果,我没有得到alt

我将那个img用于一个图库框架。所以我通过jquery为那个图库设置了一个框架。这是我的旧代码

(function ($) {
// custom image object
var gvImage = function (img) {

    this.src = { 
        panel: img.attr('src'),
        frame: img.data('frame') || img.attr('src')
    };
    this.scale = {
        panel: null,
        frame: null
    };
    this.height = 0;
    this.width = 0;
    this.attrs = {
        title: img.attr('title') || img.attr('alt'),
        description: img.data('description')
    };
    this.href = null;
    this.dom_obj = null;

    return this;
},
我也为alt添加了一些东西。这只是一个尝试。但它对我有效。这是我的新代码

(function ($) {
// custom image object
var gvImage = function (img) {

    this.src = { 
        panel: img.attr('src'),
        frame: img.data('frame') || img.attr('src')
    };
    this.alt = { 
            panel: img.attr('alt'),
            frame: img.attr('alt')
        };
    this.scale = {
        panel: null,
        frame: null
    };
    this.height = 0;
    this.width = 0;
    this.attrs = {
        title: img.attr('title') || img.attr('alt'),
        description: img.data('description')
    };
    this.href = null;
    this.dom_obj = null;

    return this;
},

这似乎是类似的问题,看看它会发生什么?为什么你仍然使用Scriptlet,尽管它们已经多年不应该再被使用了?JB,我明白你对Scriptlet的意思,但老实说,对于他所做的,唯一的选择是为像这样的琐碎的事情提供一个servlet,这是过度杀戮,或者jstl,这是granted并没有被弃用,但它的代码也很简洁。OP:你确定你的广告标题没有返回空字符串或null吗?查看页面源代码,向我们展示你的servlet容器实际输出的内容。现在这个问题已经解决了。我没有得到alt,因为有javascript效果。