<%--
Document : Profile
Created on : Jun 5, 2016, 1:28:02 AM
Author : User
--%>
<%@page import="ServletHolder.Database"%>
<%@page import="java.sql.*"%>
<%@page import="java.io.*"%>
<%
response.setHeader("Cache-Control","no-cache");
response.setHeader("Cache-Control","no-store");
response.setDateHeader("Expires", 0);
response.setHeader("Pragma","no-cache");
HttpSession s=request.getSession();
try{
String a=(String)s.getAttribute("email");
String b=(String)s.getAttribute("password");
if((a.equals("a") && b.equals("b"))){
}else{
response.sendRedirect("index.jsp");
}
}catch(Exception e){
response.sendRedirect("index.jsp");
}
Connection con=Database.getConnection();
PreparedStatement pst;
ResultSet rs;
String c="shakil123@gmail.com";
String ah="";
Blob img;
byte[] imgdata=null;
try{
String al="select * from `uploadpic` where `email`='"+c+"'";
pst=con.prepareStatement(al);
rs=pst.executeQuery();
if(rs.next()){
ah=rs.getString("email");
img=rs.getBlob("pic");
imgdata=img.getBytes(1, (int)img.length());
}
}catch(Exception e){
ah=e.toString();
}
response.setContentType("image/gif");
OutputStream o = response.getOutputStream();
// o.write(imgdata);
// o.flush();
// o.close();
%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body><!-- onload="noBack()" onpageshow="noBack()">-->
<h1>Profile</h1>
<div span="12">
<div sapan="9">
<p><strong> Hello User Welcome!!!</strong></p>
<img src="scrum-chart.jpg" alt="Mountain View" style="width:200px;"><br>
<p><%=ah%><p>
<img src="<%
o.write(imgdata);
o.flush();
o.close();
%>" alt="Profile Picture" width="200" title="Profile Picture">
</div>
<div sapan="3">
<p><strong> Advertisement</strong></p>
</div>
</div>
<a href="Editprofile.jsp"> Edit Profile</a><br>
<form action="Logout" method="post">
<input type="submit" value="Logout">
</form>
</body>
</html>
But the problem is when i am visiting my profile it only shows the image from the database.that is only retrieved image is showing in the page but the other code is not working and Other properties is not showing in the page....