File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFS: Problems with running SelectBeer.do servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFS: Problems with running SelectBeer.do servlet" Watch "HFS: Problems with running SelectBeer.do servlet" New topic
Author

HFS: Problems with running SelectBeer.do servlet

kavya krushi
Ranch Hand

Joined: Oct 25, 2000
Posts: 48
Hello folks,

I am seeing a wierd problm when i tried to deploy the servlet. I am able to see the form.html with out any problm ... but when i click the Submit, i am getting a FileDownload box which says that

"You have chosen to download a file from this location

SelectBeer.do from localhost"

and then it gives me an option to either "open the file from the current location" or "save it to the disk". When I have chose the former option it
gave me another dialog with a list of applications that can be used to open the file ... I have selected Internet Explorer and then it brought up a page which displayed the following

Beer Selection Advice <br>
<br>Got Beer Color dark

I am not sure why this is happenning ... I am new to all this web stuff ... I really appreciate it much if some can help me understand thsi problem ...

Thanks and Regards
Kavya
Peter Du
Greenhorn

Joined: Oct 29, 2004
Posts: 14
Can you show the contents of your wen.xml, and you can try the following web.xml :

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<!-- servlet mappings start -->
<servlet>
<servlet-name>Ch3 Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Ch3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>
</web-app>


Peter Du<br /> <br />SCJP1.4 SCWCD1.4 SCBCD1.3
kavya krushi
Ranch Hand

Joined: Oct 25, 2000
Posts: 48
Thanks for the response Peter ... Here are the contents of my web.xml ... I just typed everything from HFS & JSP ...



I will try with your web.html ...

Regards,
Kavya
[ November 27, 2004: Message edited by: kavya krushi ]
kavya krushi
Ranch Hand

Joined: Oct 25, 2000
Posts: 48
I had mistyped the arg for setContentType method in my doPost metohd. Instead of "text/html", i had "type/html". Once i changed that, things started working great ...

Thanks & Regards,
Kavya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFS: Problems with running SelectBeer.do servlet