Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image jsp servlet controller bean and database

 
RanjanKumar Raj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir can you please send me an example to upload an image to the server (with user defined file name and display message if name exist) at specific folder "images" and save its path to the mysql database. And again display the images uploaded on the server folder by using the path which is stored in database.
Sir i am able to upload image on server specific folder or the image directly in database in bolb datatype but i become failed to store its path in database and fetch the uploaded image using the path in database. So please guide me.
Ranjan
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does it fail?
 
RanjanKumar Raj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then please send me a simple jsp project for uploading image on the server and its name in database and display it using jsp. Please use the MVC2 pattern. Means it should be done by the help of servlet controller file.
So please.
Ranjan
 
Pushkar Choudhary
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us what have you done so far, let us know where you are stuck and we'll try to help you.

Please note that we don't hand out ready made solutions here. Read this and this.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case you're really stuck on where to start, you should break your task into two separate parts:
  • Uploading files to your application
  • Serving images to the client

  • To manage the file upload, have a look at the FileUpload helper module available in the Apache Commons library. Have a look here: http://commons.apache.org/fileupload/using.html

    Second, to serve images to the client, you need to create a Servlet, commonly known as an Image Servlet. If you search on this, you'll find lots of examples.
     
    Mark E Hansen
    Ranch Hand
    Posts: 650
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I just added an article to the ServletsFaq titled ImageServlet (http://faq.javaranch.com/java/ImageServlet) which shows how to serve images (and other multimedia content) from your Servlet-based web application.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic