如何在“操作"页面中添加图像 [英] How to add image in Action page
本文介绍了如何在“操作"页面中添加图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我编写的代码.对于此代码,我需要添加一个图像.那怎么办呢?
实际上,我以一种方式尝试过.但是它可以作为字符串接受,因此请对此提供帮助.
Hi, this is code which I have written. for this code I need to add a image. So how do it.
Actually I tried in one manner. But its accepting as a string so please help in this.
String units;
for (Object object : list) {
LiveParam liveParam = new LiveParam();
Object data[] = (Object[]) object;
// liveParam.setPramCode(data[0].toString());
liveParam.setPramDispName(data[0].toString());
// because of UI use issues i make it this
double parValue = Double.parseDouble(data[1].toString());
int iValue = 0;
units = data[5].toString();
if ((parValue * 100) % 100 == 0) {
iValue = (int) parValue;
if (units.equals("STATUSONOFF")) {
if (iValue == 0) {
liveParam.setPramValue("<img src='images/off.gif'/>");
liveParam.setUnits("OFF");
} else {
liveParam.setPramValue("<img src='images/on.gif'/>");
liveParam.setUnits("ON");
}
} else if (units.equals("STATUSYESNO")) {
if (iValue == 0) {
liveParam.setPramValue("<img src='image/off.gif'/>");
liveParam.setUnits("NO");
} else {
liveParam.setPramValue("<img src='image/on.gif'/>");
liveParam.setUnits("YES");
}
} else {
liveParam.setPramValue(iValue+"");
liveParam.setUnits(units);
}
} else {
liveParam.setPramValue(parValue + "");
liveParam.setUnits(units);
}
liveParam.setPramType(data[2].toString());
liveParam.setTimestamp(Utility.getFormattedTimeStamp(
(Timestamp) data[3], Constants.DATE_TIME_FORMAT));
liveParam.setCommunicationMedia(data[4].toString());
liveparamList.add(liveParam);
}
在上面的代码中,我添加了图像.但其接受为字符串.我将等待您的答案
In the above code I have added images. But its accepting as string. I''ll be waiting for your answer
推荐答案
我想您没有正确处理图像.您正在使用相对路径,这通常是无效的.尝试获取完整的绝对路径,然后尝试该路径.
I guess you are not addressing the images right. You are using relative paths, which is often not valid. Try to get the complete, absolute path and try that.
这篇关于如何在“操作"页面中添加图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文