Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 向HTML添加高度或宽度时未加载图像;img src";选项_Java_Html - Fatal编程技术网

Java 向HTML添加高度或宽度时未加载图像;img src";选项

Java 向HTML添加高度或宽度时未加载图像;img src";选项,java,html,Java,Html,当有高度时,图像不会加载。当我删除高度图像时,可以完美地加载原始图像大小。我只需要在网页中显示固定大小的图像。为什么我不能在代码中使用高度和宽度 <!DOCTYPE html> <html> <head> <title>Listing Images</title> </head> <body> <h1>Listing Images</h1> <table bo

当有高度时,图像不会加载。当我删除高度图像时,可以完美地加载原始图像大小。我只需要在网页中显示固定大小的图像。为什么我不能在代码中使用高度和宽度

<!DOCTYPE html>
<html>
<head>
    <title>Listing Images</title>
</head>
<body>
    <h1>Listing Images</h1>
    <table border="1">
        <tr>
            <th>Preview</th>
            <th>Available information</th>
            <th>Update Information</th>
            <th>Action</th>
            <%
                List<Files> files = (List<Files>) request.getAttribute("files");
                String path = (String) request.getAttribute("path");
                for (Files file : files) {
                out.print("<tr><td><img src="+ path+file.getFileName()+"height='200'></td></tr>");}
            %>
    </table>
</body>
</html>

列出图像
列出图像
预览
可用信息
更新信息
行动

out.print()
语句中,
src=
标记所在的位置可能需要转义字符
\“


我想把这个
打印出来。打印(“”;

你能尝试在
+“
高度之间添加空格吗?类似于这样的
。不确定这是否是问题所在,但你可以试一试,效果很好。非常感谢您的帮助。@ThilinaPalamakumbura没问题