Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Struts I want Image Album like -orkut and Facebook Using Struts 1.2
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ranvijay
I want Image Album like -orkut and Facebook Using Struts 1.2
1 Answer(s)      3 years and 3 months ago
Posted in : Struts


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...


Advertisement
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
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
Advertisements
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
facebook like button code
facebook like button code  How to create a facebook like button? can anyone share the code..?? Thanks in advance
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
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
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
Struts 1.2 and ajax example
Struts 1.2 and ajax example  Struts 1.2 and ajax example with data from database
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
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
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
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
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
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
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
diff b/w struts 1.0 and 1.2
diff b/w struts 1.0 and 1.2  diff b/w struts 1.0 and 1.2
album maker
album maker  How to make a simple album maker using java API
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
How to Retrieve Data from Facebook Using PHP
How to Retrieve Data from Facebook Using PHP  is this link has right content regards that?? http://techpdf.co.cc/blog/how-to-retrieve-data-from-facebook-using-php
How to Retrieve Data from Facebook Using PHP
How to Retrieve Data from Facebook Using PHP  is this link has right content regards that?? http://techpdf.co.cc/blog/how-to-retrieve-data-from-facebook-using-php
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
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
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
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.
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 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
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
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
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
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
Advertisements
 

 

 

DMCA.com