I wish that once a user logs in to the web app, their name and image appears. However the problem I am having is that while the name shows up correctly, the image appears as characters. I am using a jsp and the code is written in java. The name and image are saved in a MySQL database and the image is saved as a blob.
<%
try{
String session_id =null;
HttpSession session1=request.getSession(false);
if(session1!=null){
session_id=(String)session1.getAttribute("name");
}
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/bookstore", "root", "*");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select image,name from register where uid='"+session_id+"'");
rs.next();
String image = rs.getString("image");
String name = rs.getString("name");
%>
<h1>Welcome <%out.print(name);%></h1>
<table style="width:100%">
<tr>
<th>Image</th>
</tr>
<tr>
<%=image%>
</tr>
</table>
<%
}catch(Exception e){
out.println(e);
}
%>