This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Save image from Servlet  RSS feed

 
Isaac Ferguson
Ranch Hand
Posts: 1063
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to save an image from a Servlet like this:



It works well in this case but I want to save the pics in a folder called pics inside the WebPages folder like this:



Any idea, please?

Regards, Isaac
 
salvin francis
Bartender
Posts: 1604
35
Eclipse IDE Google Web Toolkit Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do you want to save it in the webpages folder ?
Consider this, you want to deploy a new war to the server, what is going to happen ?

By the way, you might want to look at ServletContext.getRealPath() method.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saving anything into the web context is a really bad idea as has already been pointed out. It will create many problems when redeploying. Save any files outside the web context.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!