how to retrieve text and images from mysql database and show on html page using jsp servlet
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
Insert title here
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="java.io.*" %>
<%
Blob image = null;
byte[] imgData = null ;
String userid=request.getParameter("usr");
//session.putValue("user",userid);
String pwd=request.getParameter("pwd");
String a="faiztechno";
String b="ziaf1234";
if(userid.equals(a) && pwd.equals(b))
out.println("LOGIN SUCCESS, WELCOME ADMIN");
else {
response.sendRedirect("login2.html");
//out.println("you are not an admin, please register");
}
%>
User Complaints:
<%
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/faiz","root","ziaf1234");
Statement st=con.createStatement();
//out.println("hello");
//ResultSet rs=st.executeQuery("select * from users where userid='"+userid+"'");
ResultSet rs = st.executeQuery("select * from complainttable"); %>
<%
while (rs.next())
{ %>
<%
//out.println("
") ;
//out.print(rs.getString(1));
} %>
Complaint Timing |
User Name |
Complaint Details |
Complaint Images |
<%out.print(rs.getString(1)); %> |
<%out.print(rs.getString(2)); %> |
<%out.print(rs.getString(3)); %> |
click
|
<% image = rs.getBlob(4);
imgData = image.getBytes(1,(int)image.length());
OutputStream o = response.getOutputStream();
o.write(imgData); %>
|
View Answers
Related Tutorials/Questions & Answers:
Advertisements
how to retrieve images from database to jsp?how to
retrieve images from database to
jsp? Hi sir,i want to stores
images along with the name and price with
database and
retrieve it on jsp.and... urgent.
1)
images:
<%@
page import="java.sql.*,java.io.*,java.util.
How to retrieve blob image from database in JSP?How to
retrieve blob image
from database in
JSP? Hello,
JSP is used... the blog image
from database.
How to
retrieve blob image
from database in
JSP?
Hi,
Please check the tutorial
Retrieve image
from database using How to store and retrieve image from database in JSP?How to store and
retrieve image
from database in
JSP? Hi,
In one... the image. Check this example:
Retrieve image
from database using Servlet.
Thanks... and
retrieve image
from database in
JSP?
Thanks
HI,
You can use
Retrieve image from mysql database through jsp
Retrieve image
from mysql database through
jsp... to
retrieve image
from
mysql database through
jsp code. First create a
database...
Note : In the
jsp code given below, image will
be retrieved
from database Retrieve image from database using ServletRetrieve image
from database using Servlet
In this example we will
show you
how to develop a
Servlet that connects to the
MySQL database and retrieves the image
from the
table. After
Fetching database field from servlet to jsp page ?Fetching
database field
from servlet to
jsp page ? Hello Java... field.
I wanted to pass some of the
database field
from servlet to
jsp...
(i... Request setAttribute method and at the
JSP page can
retrieve this value
using How to show data from database in textbox in jsp How to
show data
from database in textbox in
jsp How to
show data
from database in textbox in
jsp
Here is an example that
retrieve the particular record
from the
database and display it in textbox
using JSP.
<
get info from mysql using jsp and servletget info
from mysql using jsp and servlet HELLO! I wanna create a
jsp page which able to let me get its name, phone and other info by asking the user to key in their email address
from mysql database by
using servlet and
jsp too
how to insert data in database using html+jsphow to insert data in
database using html+jsp anyone know what... = 0;
// sql query to
retrieve values
from the specified...; Here we have used
MySQL database:
1)form.html:
<html>
<form
HTML & MYSQL - retrieve record from tableHTML &
MYSQL -
retrieve record
from table Hi. I have a field...,trichy,kanchipuram for a single record. I have to
retrieve these data
from the field... it in
html.
how to do
Image upload in mysql database using jsp servletImage upload in
mysql database using jsp servlet Hello, I need code to insert image in
mysql database, I have seen the code which is already in your portal but it is not inserting image into
database it save in the folder
Show image and text on same jsp pageShow image and
text on same
jsp page Hi all,
I have to display image and
text on the same
jsp page.
The
text and image are both retrived
from mysql database.
The image is shown correctly on seperate
jsp page but when shown
How to retrieve array values from html form to jsp?How to
retrieve array values
from html form to
jsp? Hi! I am... it into
jsp. Means i just want to
retrieve values
from html form containing array... sample code for
how to retrive array values
from html to
jsp.
hi friend