Gallery Photo

Ads
 

Gallery Photo

I need to display a photo gallery with the path stored in oracle with the possibility of their supprission (photo management) (with jsf or with jsp)

View Answers

May 23, 2013 at 7:16 PM

hi friend,

Do not do such task using JSP, Better option is to use Servlet. It will be better than the JSP.

Thanks


May 24, 2013 at 6:55 PM

hi fried,

Try the following code, may this will be helpful for you

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*, java.awt.image.*, javax.imageio.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Display Data</title>
</head>
<body>
<form action="#">
<table>
<tr>
<td>Enter Image ID </td>
<td><input type="text" name="id"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Register"/></td>
</tr>
</table>
</form>
<%! String driverName = "com.mysql.jdbc.Driver";%>
<%! String url = "jdbc:mysql://localhost:3306/record";%>
<%! String user = "root";%>
<%! String psw = "root";%>
<%
String imgID = request.getParameter("id");
if(imgID != null)
{
    int i = Integer.parseInt(imgID);
Connection con = null;
PreparedStatement ps = null;
File file = null;
InputStream in = null;

try
{
    Class.forName(driverName);
    con = DriverManager.getConnection(url,user,psw);
    String sql = "SELECT * FROM image where img_id="+i;
    ps = con.prepareStatement(sql);
    ResultSet rs = ps.executeQuery();
    while(rs.next())
    {
        byte[] img = rs.getBytes("img_data");
        String location = rs.getString("img_location");
        String name = rs.getString("img_name");     
        /*in = new ByteArrayInputStream(img);
        BufferedImage bImageFromConvert = ImageIO.read(in);
        System.out.println("bImageFromConvert : "+bImageFromConvert);
        */
        file = new File(location+"/"+name);
        response.setContentType("image");
        response.getOutputStream().write(img);
        response.getOutputStream().flush();
        response.getOutputStream().close();
        %>
        <IMG SRC="<%=file %>" WIDTH="200" HEIGHT="50" 
   BORDER="0">
        <%
    }
}   
catch(SQLException sqe)
{   
    out.println(sqe);
}
}
%>
</body>
</html>

Ads









Related Tutorials/Questions & Answers:
Gallery Photo
Gallery Photo  I need to display a photo gallery with the path stored in oracle with the possibility of their supprission (photo management) (with jsf or with jsp)   hi friend, Do not do such task using JSP, Better
ModuleNotFoundError: No module named 'simple-photo-gallery'
ModuleNotFoundError: No module named 'simple-photo-gallery'  Hi...: No module named 'simple-photo-gallery' How to remove the ModuleNotFoundError: No module named 'simple-photo-gallery' error? Thanks   Hi
Advertisements
photo album
photo album  while syncing photos to my photo album in my iphone, the photo albumj ust got crashed i guess. Under photos option i just have the camera roll option now!! What should i do to get the photo album back
photo uploading
photo uploading  i want the code upload the image in oracle database
photo viwer
photo viwer  i need coding for photo viewer using jsp mysql   Please visit the following link: http://www.roseindia.net/jsp/downloadimage.shtml
Image Gallery
and am having an issue with the image gallery. The goal is to create multiple categories with an image gallery for each. For example,the wedding gallery...="padd-2">our GALLERY </h2> </div> <div class
Image Gallery
and need your guidance. The specific piece of the site is an image gallery... class="padd-2">our GALLERY </h2> </div> <div...="" width="280" height="262"></a> <a href="BIG PHOTO LINK" rel
Adding photo to iPhone simulator
Adding photo to iPhone simulator  Hi, there is no photo in my iPhone simulator.. how can i add one? Please suggest. Thanks
upload photo in xcode
upload photo in xcode  how can i upload a photo in a view in xcode? i am a beginner in xcode please help me
save uiimage to photo library
save uiimage to photo library  How to saved the clicked picture on camera roll in iPhone. I always want to write the file into photo library.   Save UIImage to photo library Creating a camera application in iPhone need
Photo upload, Download
Photo upload, Download  Hi I am using NetBeans IDE for developing... am loading photo. BufferedImage image=null; JFileChooser chooser = new...()); } } Here I'll get path of the photo in local machine in variable "path" (I
ModuleNotFoundError: No module named 'Gallery'
ModuleNotFoundError: No module named 'Gallery'  Hi, My Python... 'Gallery' How to remove the ModuleNotFoundError: No module named 'Gallery... to install padas library. You can install Gallery python with following command
Upload Photo to Server
Upload Photo to Server  Hi I am using NetBeans IDE for developing... i am loading photo. BufferedImage image=null; JFileChooser chooser...()); } } Here I'll get path of the photo in local machine in variable "path
ModuleNotFoundError: No module named 'mera_photo'
ModuleNotFoundError: No module named 'mera_photo'  Hi, My Python... 'mera_photo' How to remove the ModuleNotFoundError: No module named 'mera_photo' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'natgeo_photo'
ModuleNotFoundError: No module named 'natgeo_photo'  Hi, My Python... 'natgeo_photo' How to remove the ModuleNotFoundError: No module named 'natgeo_photo' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'natgeo_photo'
ModuleNotFoundError: No module named 'natgeo_photo'  Hi, My Python... 'natgeo_photo' How to remove the ModuleNotFoundError: No module named 'natgeo_photo' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'photo-org'
ModuleNotFoundError: No module named 'photo-org'  Hi, My Python... 'photo-org' How to remove the ModuleNotFoundError: No module named 'photo... have to install padas library. You can install photo-org python with following
ModuleNotFoundError: No module named 'photo-calendar'
ModuleNotFoundError: No module named 'photo-calendar'  Hi, My... named 'photo-calendar' How to remove the ModuleNotFoundError: No module named 'photo-calendar' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'photo-dl'
ModuleNotFoundError: No module named 'photo-dl'  Hi, My Python... 'photo-dl' How to remove the ModuleNotFoundError: No module named 'photo-dl... to install padas library. You can install photo-dl python with following
ModuleNotFoundError: No module named 'photo-gen'
ModuleNotFoundError: No module named 'photo-gen'  Hi, My Python... 'photo-gen' How to remove the ModuleNotFoundError: No module named 'photo... have to install padas library. You can install photo-gen python with following
ModuleNotFoundError: No module named 'photo-grid'
ModuleNotFoundError: No module named 'photo-grid'  Hi, My Python... 'photo-grid' How to remove the ModuleNotFoundError: No module named 'photo-grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'photo-import'
ModuleNotFoundError: No module named 'photo-import'  Hi, My Python... 'photo-import' How to remove the ModuleNotFoundError: No module named 'photo-import' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'photo-org'
ModuleNotFoundError: No module named 'photo-org'  Hi, My Python... 'photo-org' How to remove the ModuleNotFoundError: No module named 'photo... have to install padas library. You can install photo-org python with following
ModuleNotFoundError: No module named 'photo-sorter'
ModuleNotFoundError: No module named 'photo-sorter'  Hi, My Python... 'photo-sorter' How to remove the ModuleNotFoundError: No module named 'photo-sorter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'photo-uploader'
ModuleNotFoundError: No module named 'photo-uploader'  Hi, My... named 'photo-uploader' How to remove the ModuleNotFoundError: No module named 'photo-uploader' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'unach-photo'
ModuleNotFoundError: No module named 'unach-photo'  Hi, My Python... 'unach-photo' How to remove the ModuleNotFoundError: No module named 'unach-photo' error? Thanks   Hi, In your python environment
create dynamic image gallery jquery
create dynamic image gallery jquery  How to create a dynamic image gallery in Jquery
ModuleNotFoundError: No module named 'aldryn-gallery'
ModuleNotFoundError: No module named 'aldryn-gallery'  Hi, My... named 'aldryn-gallery' How to remove the ModuleNotFoundError: No module named 'aldryn-gallery' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'aldryn-gallery'
ModuleNotFoundError: No module named 'aldryn-gallery'  Hi, My... named 'aldryn-gallery' How to remove the ModuleNotFoundError: No module named 'aldryn-gallery' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'aldryn-gallery'
ModuleNotFoundError: No module named 'aldryn-gallery'  Hi, My... named 'aldryn-gallery' How to remove the ModuleNotFoundError: No module named 'aldryn-gallery' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'aldryn-gallery'
ModuleNotFoundError: No module named 'aldryn-gallery'  Hi, My... named 'aldryn-gallery' How to remove the ModuleNotFoundError: No module named 'aldryn-gallery' error? Thanks   Hi, In your python

Ads