aspose file tools*
The moose likes Servlets and the fly likes different behavior occurs, why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "different behavior occurs, why?" Watch "different behavior occurs, why?" New topic
Author

different behavior occurs, why?

hisham ragheb
Ranch Hand

Joined: Apr 14, 2008
Posts: 30
i created a web application to download a jar file...but when i run the application it tries to open the servlet itself

here is the code

The Servlet:



this is the form.html(reside in the application context root):





This is the web.xml file:




i place the servlet-api.jar in the application context root as supposed...but whe i click the download button a dialog from the browser appears to either save dodo.do file or to choose a file to open it....how is that....why???


SCJP 1.5 (94%), SCWCD 1.4 (91%), SCBCD 1.5 (95%)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61064
    
  66

Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61064
    
  66

hisham ragheb wrote:i place the servlet-api.jar in the application context root as supposed

Incorrect. You must not copy the servlet-api.jar anywhere! Just leave it in the Tomcat folder where it belongs!

Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

but whe i click the download button a dialog from the browser appears to either save dodo.do file or to choose a file to open it....how is that....why??


I think you want to check out this link: http://www.javaworld.com/javaworld/javatips/jw-javatip94.html

Sean


I love this place!
hisham ragheb
Ranch Hand

Joined: Apr 14, 2008
Posts: 30
Bear Bibeault wrote:
hisham ragheb wrote:i place the servlet-api.jar in the application context root as supposed

Incorrect. You must not copy the servlet-api.jar anywhere! Just leave it in the Tomcat folder where it belongs!



you didnt understand....i just took a copy from the tomcathome/lib just to test my web application

of course i didnt took the one that tomcat use :wink

i just took a copy of any jar file to test its downloading
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: different behavior occurs, why?