Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

file content type  RSS feed

 
jazy smith
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am downloading a text file from unix box through SFTP using java. And I am dispaying that file using JSP.
In my jsp,

the whole functionality works fine. It does fetch the file from unix box and saves that file to my local windows, except in my file at the beginning I see,
and the at the end of the file also the same tags ending. I guess it must be the problem with charecter set encoding. But not sure. Any idea ?

thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because you are using a hammer when a screwdriver is needed. JSP is not an appropriate technology for this. You should be doing this in a servlet.
 
jazy smith
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ Bear : You're the best man ! it worked. Awesome !

If you don't mind, would you please let me know why is it so ? why jsp didn't show up the correct format while the same code written in servlet, turned up perfect !

Would you please share your logic ?

thanks again
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because JSP assumes that you are producing text output such as an HTML page. It is not suitable for binary formats.

Please read this article for more information.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!