aspose file tools*
The moose likes Servlets and the fly likes Image jsp servlet controller bean and database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Image jsp servlet controller bean and database" Watch "Image jsp servlet controller bean and database" New topic
Author

Image jsp servlet controller bean and database

RanjanKumar Raj
Greenhorn

Joined: Nov 10, 2009
Posts: 4
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

Joined: Jan 10, 2002
Posts: 60048
    
  65

How does it fail?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
RanjanKumar Raj
Greenhorn

Joined: Nov 10, 2009
Posts: 4
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

Joined: May 21, 2006
Posts: 425

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

Joined: Apr 01, 2009
Posts: 642
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

    Joined: Apr 01, 2009
    Posts: 642
    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Image jsp servlet controller bean and database
     
    Similar Threads
    save a file using jspsmartupload
    jspsmartupload
    blocking access to images
    Blocking access to images
    blocking access to images