Javatpoint Logo

how to insert profile image with profile details and also retrieve and set image on jsp page please provide me in brief

By: pandey*** On: Tue Oct 28 13:45:46 IST 2014     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Login page</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/jquery-ui.css" type="text/css"/>
<link rel="stylesheet" href="css/header.css">
<script src="/scripts/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="/scripts/jquery.form.min.js" type="text/javascript"></script>
</head>

<%

String value=(String)request.getAttribute("val");


Connection con = null;
String url = "jdbc:mysql://localhost:3307/";
String db = "new";
String driver = "com.mysql.jdbc.Driver";
String userName ="root";
String password="root";
PreparedStatement pst = null;

try{
System.out.println(value);
Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);
String query = "select * from login where username=?";
pst = con.prepareStatement(query);
pst.setString(1,value);
ResultSet rs = pst.executeQuery();
%>

<%
while(rs.next()){
%>

<div class="header">
<span id="applicationTitle" style="font-size: 20px;font-family: Magneto;"><b>Welcome, </b><%=rs.getString(3)%>  <%=rs.getString(4)%></span>
<div style="position: absolute; top: 25px; right: 300px;">
<jsp:include page="index1.jsp"></jsp:include>
</div>
</div>

<body>
<%@ page import="java.sql.*" %>

<div class="mainContainer" style="position: relative;top: -15px">
<div class="changingDiv">

<div class="signUpInfo1">


<div class="img">

<%=rs.getBinaryStream(17)%>/// this is image place and
<table style="top:150px;position:relative;">
<tr>
<td><span style="font-size: 18px;color: #adf0e6">Profile Name</span></td>
<td><%=rs.getString(3)%>  <%=rs.getString(4)%></td>
</tr>

<tr>
<td><span style="font-size: 18px;color: #adf0e6">Email Id</span></td>
<td><%=rs.getString(5)%></td>
</tr>

<tr>
<td><span style="font-size: 18px;color: #adf0e6">Mobile Number</span></td>
<td><%=rs.getString(8)%></td>
</tr>

<tr>
<td><span style="font-size: 18px;color: #adf0e6">Gender</span></td>
<td><%=rs.getString(7)%></td>
</tr>

<tr>
<td><span style="font-size: 18px;color: #adf0e6">Current Location</span></td>
<td><%=rs.getString(13)%></td>
</tr>
</table>
<%
}
%>
<%
}
catch(Exception e){
e.printStackTrace();
}
%>
</div>

<div class="friendlist">
<span class="friendlistTitle">Friend List</span><hr/>
//....
</div>
<div class="mainContent">
<div style="background: #e5f3ef ; width: 535px;border-radius: 5px 5px 5px 5px;">
<div style="background: no-repeat; width: 500px;">
<form style="margin:0; padding: 10px 0 10px 50px;" method="get" target="_blank" action="" accept-charset="UTF-8" onsubmit="">
<fieldset style="margin: 0; padding: 0; border: none;">
<legend style="margin: 0; padding: 0; display: none;">Search LIBRIS</legend>
<div><input name="SEARCH_ALL" id="LIBRIS_SEARCH2" type="text" style="vertical-align: 2; font-size: 11px; width: 60%;"/> <input type="submit" value="Friend Search" style="vertical-align: bottom; cursor: pointer; font-size: 11px;"/></div>
<input type="hidden" id="LANG" name="LANG" value="en" />
</fieldset>
</form>
</div>
</div><hr style="background: #e5f3ef ;width: 470px; margin-right: 75px;"/>
</div>
<div class="Calender">
<span class="peoplelist">Follow Us</span><hr
Up0Down