如何在jsp中动态插入alt标签 [英] How to insert alt tags dynamically in jsp
本文介绍了如何在jsp中动态插入alt标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在以下jsp代码行中插入alt标记,我该如何实现?
I want to insert an alt tag in the following lines of jsp code how do I accomplish this?
<li class="carousel-promo">
<div>
<c:choose>
<c:when test="${mediaType eq 3}">
<dsp:valueof param="media.data" valueishtml="true"/>
</c:when>
<c:when test="${mediaType eq 1}">
<dsp:getvalueof var="imgURL" param="media.url" />
<img src='<dsp:valueof value="${imgURL}"/>' /> <br />
</c:when>
</c:choose>
</div>
</li>
推荐答案
im假设您是要向img-tag添加alt属性:
im assuming you meant adding an alt attribute to the img-tag:
在尝试设置alt属性时只需执行以下操作即可.此示例使用media.description作为媒体对象上属性的名称来设置通过dsp标签获取的变量的值.
just do something like this when trying to set the alt attribute. this example sets the value of the variable fetched via the dsp-tag using media.description as a name of the property on your media object.
<c:when test="${mediaType eq 1}">
<dsp:getvalueof var="imgAltText" param="media.description" />
<dsp:getvalueof var="imgURL" param="media.url" />
<img alt='<dsp:valueof value="${imgAltText}"/>' src='<dsp:valueof value="${imgURL}"/>' /> <br />
</c:when>
希望有帮助....
这篇关于如何在jsp中动态插入alt标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文