Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.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 如何从数据库中检索图像路径并使用jsp在html中显示_Java_Html_Jsp - Fatal编程技术网

Java 如何从数据库中检索图像路径并使用jsp在html中显示

Java 如何从数据库中检索图像路径并使用jsp在html中显示,java,html,jsp,Java,Html,Jsp,这是我的jsp代码 Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/usha","root","mysql"); Statement st = con.createStatement(); String query="select name from ima

这是我的jsp代码

Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/usha","root","mysql");
            Statement st = con.createStatement();
               String query="select name from image";

            ResultSet rs=st.executeQuery(query);

            while(rs.next())
            {
                %><img src="<%=rs.getString("name")%>"/><%
            }

            st.close();

            con.close();
Class.forName(“com.mysql.jdbc.Driver”);
Connection con=DriverManager.getConnection(“jdbc:mysql://localhost:3306/usha“、”根“、”mysql”);
语句st=con.createStatement();
String query=“从图像中选择名称”;
结果集rs=st.executeQuery(查询);
while(rs.next())
{

%>“/>为什么要在源路径中添加
localhost
。?我删除了它,但无法获取图像图像图像图像位置是否与jsp页面相同?或者不同?如果不同,则需要使用相对路径进行解析。示例:
”/>
现在,我已经获得了它。谢谢你。。。