aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Problem getting the Beer Selection Page screen shot 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 "Problem getting the Beer Selection Page screen shot" Watch "Problem getting the Beer Selection Page screen shot" New topic
Author

Problem getting the Beer Selection Page screen shot

a alph
Ranch Hand

Joined: Nov 18, 2008
Posts: 36
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

Joined: Jan 22, 2007
Posts: 400

would you like to post you code here along with DD ??


SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
a alph
Ranch Hand

Joined: Nov 18, 2008
Posts: 36
Hi,

The code is:



The DD is:


Thanks.
Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

...and where is form.html?? it would be difficult to figure out the problem without all code.
a alph
Ranch Hand

Joined: Nov 18, 2008
Posts: 36
The form.html is:



Thanks.
Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

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

Joined: Aug 03, 2008
Posts: 9305
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ravinderjit Singh
Ranch Hand

Joined: Jan 13, 2010
Posts: 78
For me too it is working fine.
a alph
Ranch Hand

Joined: Nov 18, 2008
Posts: 36
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

Joined: Jan 13, 2010
Posts: 78
What is the response when you submit the query?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9305
    
  17

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

Joined: Nov 18, 2008
Posts: 36
Yes, it is showing it as you open a html file as a text.
Pushkar Choudhary
Rancher

Joined: May 21, 2006
Posts: 425

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

Joined: Nov 18, 2008
Posts: 36
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

Joined: Aug 03, 2008
Posts: 9305
    
  17

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

Joined: Apr 21, 2008
Posts: 432
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

Joined: Aug 03, 2008
Posts: 9305
    
  17

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

Joined: Apr 21, 2008
Posts: 432
Hi, Ankit.

Yes. What you said is correct.
Harpreet Singh janda
Ranch Hand

Joined: Jan 14, 2010
Posts: 317

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

Joined: Nov 18, 2008
Posts: 36
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

Joined: Jan 22, 2007
Posts: 400

You are most welcom...
 
 
subject: Problem getting the Beer Selection Page screen shot