I have retrieved url to an image from database.Now,i want to use this url to display an image on the JSP page.
I am retrieving the value of url using this code--
<%
try{
Class.forName("com.mysql.jdbc.Driver");
try(Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/asad","root","1234");){
//database connection
System.out.println("driver registered");
Statement s=conn.createStatement();
String searchby=request.getParameter("searchby");
String param=request.getParameter("name");
String q="";
System.out.println("before pstmt");
q="select * from asad.book where genre"+"=?";
PreparedStatement pstmt=(PreparedStatement)conn.prepareStatement(q);
pstmt.setString(1,param);
System.out.println("after pstmt");
System.out.println("param is "+param+" searchby is "+searchby);
ResultSet rs =(ResultSet) pstmt.executeQuery();
// ResultSetMetaData rsmd=(ResultSetMetaData) rs.getMetaData();
while(rs.next())
{
System.out.println(rs.getString(1));
String url=rs.getString(3);
%>
To do this,i wrote --
<img src="<% url %>" style=width:350px;height:350px>
Eclipse is showing error in the above img
tag statement.Can someone help me with this ?