I want Image Album like -orkut and Facebook Using Struts 1.2

I want Image Album like -orkut and Facebook Using Struts 1.2

photo gallery Iam uploading images in the serverusing uploading program, now i need to display all the images from the folder and i want to display it on JSP. like facebook and orkut did.. Please suggest me....

How to store the link of a image in a database. it is neccessary..... I am using a link "Photo Gallery" to show the image.

Pls reply ASAP...

View Answers

July 26, 2011 at 12:46 PM

1)images.jsp:

<%@ page import="java.sql.*,java.io.*,java.util.*" %> 
<HTML>
 <table border="1">

   <%
  try{      
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
    Statement stmt=con.createStatement();
    String strQuery = "select * from image";
    ResultSet rs = stmt.executeQuery(strQuery);
    while(rs.next()){
       %>
      <tr>
       <td>
      <img src="image.jsp?imgid=<%=rs.getInt(1)%>" width="50" height="50">
</td>
      </tr>
      <%
    }
    rs.close();
    con.close();
    stmt.close();
  }
  catch(Exception e)
  {
    e.getMessage();
  }
  %>
 </table>
</HTML>

2)image.jsp:

<%@ page import="java.sql.*,java.io.*,java.util.*" %> 
<%
  int id =  Integer.parseInt(request.getParameter("imgid"));
  try{      
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");      
    Statement st=con.createStatement();
    String strQuery = "select images from image where id="+id;
    ResultSet rs = st.executeQuery(strQuery);

    String imgLen="";
    if(rs.next()){
      imgLen = rs.getString(1);
       }  
    rs = st.executeQuery(strQuery);
    if(rs.next()){
      int len = imgLen.length();
      byte [] rb = new byte[len];
      InputStream readImg = rs.getBinaryStream(1);
      int index=readImg.read(rb, 0, len);  
      st.close();
      response.reset();
      response.getOutputStream().write(rb,0,len); 
      response.getOutputStream().flush();        
    }
  }
  catch (Exception e){
    e.printStackTrace();
  }
%>









Related Tutorials/Questions & Answers:
i want image upload and download useing STRUTS 1.2 version example..
i want image upload and download useing STRUTS 1.2 version example..  i am fresher of the developer..i want code for above title topic(i want image upload and download useing STRUTS 1.2 version example..)..plz send me code for my
i want make a simple tools like turnitin using java
i want make a simple tools like turnitin using java  it just simple tools can select the file like .doc,.pdf,.txt..the tools can read inside the file and make a searching at internet and give the source the source come from where
Advertisements
Image Album
Image Album  hi, i want to save image on server folder. and i want to save URL of this folder and name of image in database.on click of a link... in database. how can i do this please suggest me.. I am using Struts 1.2...Thanks
i want to save image on server folder. and i want to save URL of this folder and name of image in database
i want to save image on server folder. and i want to save URL of this folder and name of image in database  hi i want to save image on server folder. and i want to save URL of this folder and name of image in database.on click
Can i insert image into struts text field
Can i insert image into struts text field  please tell me can i insert image into text field
I want detail information about switchaction? - Struts
I want detail information about switch action?  What is switch action in Java? I want detail information about SwitchAction
Help me to create a sharing text just like facebook using jsp servlet and oracle
Help me to create a sharing text just like facebook using jsp servlet and oracle   I tried to use lot of methods but i couldn't get the proper method... thing is that i want to pass a value to servlet without refreshing the whole jsp
facebook like button code
facebook like button code  How to create a facebook like button? can anyone share the code..?? Thanks in advance
how can create album in java by using Stack ....
how can create album in java by using Stack ....  hi all , if i press push button put the image to the stack , and when i press pop button remove the image ..??? please help me please
using ajax i want to insert data into oracle database
using ajax i want to insert data into oracle database  i would like to insert/update/select/delete from jsp to oracle database using ajax? please send a code for this iam using oracl database thank you
i want to do a project using jsp and servlet....What are all the materials i need to study
i want to do a project using jsp and servlet....What are all the materials i need to study   i want to do a project using jsp and servlet....What are all the materials i need to study ?   Please visit the following
need a sample project using java technologies like jsp, servlets, struts
need a sample project using java technologies like jsp, servlets, struts  Hi everybody! I have learnt core java,jdbc,jsp,servlets & struts. Please guide me where can i find sample project like library management, CMS or any
How can I generate diff image using Jmagick?
How can I generate diff image using Jmagick?  Hi, I used 'compare...: 2008.67 (0.0306503) all: 1536.39 (0.0234439) I am not able to do this using Jmagick. Can anybody help me get a diff image with similar metric using Jmagick
sir i want small project with of health care system with struts and hibernate plz help me
sir i want small project with of health care system with struts and hibernate plz help me  sir i want small project on health care system with struts and hibernate plz help me
I Want to take mqsyl batabase backup using jsp
I Want to take mqsyl batabase backup using jsp   I was develop web portal using jsp and servelt. I need to take backup my MySQL database and restore another one MySQL database.   import java.util.*; import java.io.
Dynamic tabs in struts 1.2
Dynamic tabs in struts 1.2  I want to build two tabs in my page using Struts 1 , where when one of the tab is clicked it refreshes the page and shows...) ,footer..coded by using tiles
Doubts on Struts 1.2 - Struts
Doubts on Struts 1.2  Hi, I am working in Struts 1.2. My requirement..., I am sending you a link. I hope that, this link will help you. Please visit for more information. http://www.roseindia.net/struts/ Thanks
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..   i want to convert... project.. but i cant convert Image file to its byte code format.. if anybody can plz
Changing from Struts 1.2 to Struts 2.0 in Application
latest version of struts 2.0. I want to know following things 1.what...Changing from Struts 1.2 to Struts 2.0 in Application  Hi All, We have a financial application which is running successfully on struts 1.2 and java
Internationalization using struts - Struts
Internationalization using struts   Hi, I want to develop a web application in Hindi language using Struts. I have an small idea... to convert hindi characters into suitable types for struts. I struck here please
how to re size image proportionately using java for different images like jpeg, png, gif.
how to re size image proportionately using java for different images like jpeg, png, gif.  hi, i need sample code for re size image proportionately using java for different images like jpeg, png, gif, this code for my
how to resolve the problem like when i extract the struts-blank-1.3.10.war it shows java .io.filenotfound
how to resolve the problem like when i extract the struts-blank-1.3.10.war it shows java .io.filenotfound  Hai, To Extract war file jar -xvf struts...\madhavi>d: D:>cd sapp D:\sapp>jar -xvf struts-blank-1.3.10.jar
i want to select a multiple value of check box by using onclick or onchange event without using from submission
i want to select a multiple value of check box by using onclick or onchange event without using from submission   i have 4 check box name 1)profile... the result is ok but after getting value of first box now i want a result of second box
How can i use Facebook connect button
How can i use Facebook connect button  Please to meet you all guys I wonder how can i use this Connect to facebook for me to post in a particular... to facebook" feature like this site do http://www.barkadafm.net/ By the way
Struts 1.2 and ajax example
Struts 1.2 and ajax example  Struts 1.2 and ajax example with data from database
Version of com.shamanland>facebook-like-button dependency
List of Version of com.shamanland>facebook-like-button dependency
I nedd Paypal processing source code in struts and how to develope weather reports using web-api - Struts
I nedd Paypal processing source code in struts and how to develope weather reports using web-api  I nedd Paypal processing source code in struts and how to develope weather reports using web-api
I want to learn maven
I want to learn maven  Hi, I have to work on the maven based projects in my company. So, I want to learn it in 5-6 days. How to start learning Maven... like to tell you that you can learn and start using Maven in 5-6 days. Maven
I want to Do Addtion ,Substraction,Division,Multiplication in C Without using Any Arithmetic Operators - Development process
I want to Do Addtion ,Substraction,Division,Multiplication in C Without using Any Arithmetic Operators  I want to Do Addtion ,Substraction,Division,Multiplication in C Without using Any Arithmetic Operators. plz Help Me
I want to Do Addtion ,Substraction,Division,Multiplication in C Without using Any Arithmetic Operators - Development process
I want to Do Addtion ,Substraction,Division,Multiplication in C Without using Any Arithmetic Operators  I want to Do Addtion ,Substraction,Division,Multiplication in C Without using Any Arithmetic Operators. plz Help Me
i want code of signing off from a account how its done in jsp and servlet by using either cookies or session
i want code of signing off from a account how its done in jsp and servlet by using either cookies or session   sig
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse  please help me i have to submit this soon
i need a school appication using struts frame work with oracle 10g using myeclipse6.0
i need a school appication using struts frame work with oracle 10g using myeclipse6.0   hi i need a school apllication using struts frame work backend 10g xe using myeclipse 6.0
create a form using struts
create a form using struts  How can I create a form for inputting text and uploading image using struts
i want to copy files from one machine to other using java and the code will be running on third machine
i want to copy files from one machine to other using java and the code will be running on third machine  i want to copy some files from one machine... machine say 'c'. So , can you help me on this that how can i do this using
dynamicaly change URL in struts 1.2
dynamicaly change URL in struts 1.2  I need to change the url dynamically on particular button click. for example:-http://www.roseindia.net/answers... of sign like "=" have to show forward slash
I want to learn maven
I want to learn maven  Hi, I have to work on the maven based projects in my company. So, I want to learn it in 5-6 days. How to start learning Maven? Can I learn Maven in 5-6 days. Thanks
i want to update values
i want to update values  in my form i have 2 submit buttons one... database and it need to insert automatically in to disabled text boxs and once i press the edit button all text boxs need to enable so that i can edit my details
using captcha with Struts - Struts
using captcha with Struts  Hello everybody: I'm developping a web application using Struts framework, and i would like to use captcha  Hi friend,Java Captcha in Struts 2 Application :http://www.roseindia.net
i want to learn Jquery
i want to learn Jquery  i want to learn jquery can u plz guide me   Yes, you can learn these technologies by yourself. Go through the following links: Ajax Tutorials JSON Tutorials JQuery Tutorials
i want code of signing off from a account how its done in jsp and servlet by using either cookies or session
i want code of signing off from a account how its done in jsp and servlet by using either cookies or session   sig   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 http://roseindia.net/jsp/bank.shtml
Struts 1.2 Vs Struts 2.0 - Struts
Struts 1.2 Vs Struts 2.0   Hi, Can u give difference between struts 1.2 and struts 2.0 . Thanks prakash  Hi Friend, Please visit the following link: http://www.roseindia.net/struts/struts2/Struts2vsStruts1
image upload - Struts
image upload  Can any one help me how to upload an image using struts
i want for statement codding
i want for statement codding  what is the for condition following out put 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
Struts - Jboss - I-Report - Struts
Struts - Jboss - I-Report  Hi i am a beginner in Java programming and in my application i wanted to generate a report (based on database) using Struts, Jboss , I Report
ModuleNotFoundError: No module named 'facebook_image_search'
ModuleNotFoundError: No module named 'facebook_image_search'  Hi...: No module named 'facebook_image_search' How to remove the ModuleNotFoundError: No module named 'facebook_image_search' error? Thanks   Hi
i want code for these programs
i want code for these programs   Advances in operating... available and suitable platform) Design, develop and execute a program using any..., and execute a program to solve a system of n linear equations using Successive Over
I want this jsp answers
I want this jsp answers    How can we declare third party classes... for particular jsp pages? If we want to develop any jsp pages using eclipse where we can... servlet? Can we print the messages by using the expressions in case of jsp
I want this jsp answers
I want this jsp answers    How can we declare third party classes... for particular jsp pages? If we want to develop any jsp pages using eclipse where we can... servlet? Can we print the messages by using the expressions in case of jsp
Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP
Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP  as i said i want... the database using JSP. like country,state,city..please guide me

Ads