File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem getting the Beer Selection Page screen shot

 
a alph
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to do the Beer Selection Program in page 77 (HFSJ book).
When I type http://localhost:8080/Beer-v1/form.html in my browser, I only get the html file and not the actual screen shot.

I searched the forum for this type of problem and I couldn't solve it.

Can anybody please help me.

Thanks.
 
Minhaj Mehmood
Ranch Hand
Posts: 400
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
would you like to post you code here along with DD ??
 
a alph
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The code is:



The DD is:


Thanks.
 
Minhaj Mehmood
Ranch Hand
Posts: 400
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...and where is form.html?? it would be difficult to figure out the problem without all code.
 
a alph
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The form.html is:



Thanks.
 
Minhaj Mehmood
Ranch Hand
Posts: 400
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see any problem with your code, even i copy paste all your code and created new web app using eclipse and deployed it to my local tomcat and its working perfect.
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us a screenshot of what you are getting as output as I think the html is okay and you should get the correct output...
 
Ravinderjit Singh
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me too it is working fine.
 
a alph
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies.
But I'm getting the following page:
I don't know what's wrong!



<html><body>

<h1 align="center">Beer Selection Page</h1>

<form method="POST"

action="SelectBeer.do">

Select beer characteristics



Color:

<select name="color" size="1">

<option value="light"> light </option>

<option value="amber"> amber </option>

<option value="brown"> brown </option>

<option value="dark"> dark </option>

</select>





<center>

<input type="SUBMIT">

</center>

</form> </body> </html>


Thanks.

 
Ravinderjit Singh
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the response when you submit the query?
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you telling us that your browser is actually rendering that html as a text in your browser i.e. instead of parsing it, just showing it as you opened that html file in notepad??
 
a alph
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is showing it as you open a html file as a text.
 
Pushkar Choudhary
Rancher
Posts: 425
Android Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just out of curiosity, have you tried going to the folder where you have kept your html page and tried double-clicking it? Does it open in the browser like an html page or does it open like a text version of an html file?
 
a alph
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried going to the folder and double click on the html file, it brings up the text page of the form.html

I don't know what else can I do to get the actual result.

Thanks.
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your browser has gone insane, I copied the HTML that you posted and created an HTML file and put the code in it and opened it in the browser and I got the page properly. Try a different browser. Also are you sure you copied the whole code of form.html here??
 
Chinmaya Chowdary
Ranch Hand
Posts: 432
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Alph.

Have you created or modified <mime-mapping> element in default 'web.xml' in conf/web.xml that relates to 'html' files or have you overriden in 'Beer-v1' application?
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chinmaya that doesn't matter as the browser is opening the html file as text even if opening the html file from the windows explorer. So either there is something wrong with the markup of the page or character set of the page (maybe) or the browser...
 
Chinmaya Chowdary
Ranch Hand
Posts: 432
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Ankit.

Yes. What you said is correct.
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please re check the extention of the file? It should be .html.
If you are creating a html file using notepad then the possibility is that you have saved it as html file but if you do not select "all" for "save as type" drop down and do not enclosed the name of the file in double quotes then notepad will add a .txt extention to the file and browser will render that file as as a normal text file.
 
a alph
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Harpreet.
I created again those files using notepad and saved it like you said. (Before I didn't use notepad to create these files).
Then only I noticed, the web.xml file was saved as web.html. May be this was the problem.
Now it works fine. Thanks again.

Thanks everybody for your replies.


 
Minhaj Mehmood
Ranch Hand
Posts: 400
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are most welcom...
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic