• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFS: Problems with running SelectBeer.do servlet

 
kavya krushi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
kavya krushi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic