aspose file tools*
The moose likes Servlets and the fly likes servlet Not able to fetch value from html file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet Not able to fetch value from html file" Watch "servlet Not able to fetch value from html file" New topic
Author

servlet Not able to fetch value from html file

sauris kumar saurabh
Greenhorn

Joined: Jan 12, 2011
Posts: 1
i had made a html page in which i have to select value from drop down list ,and as i click submit ,that selected value should be displayed with some text.
the servlet is displaying the static text but is not able to fetch the value from html file ...please help








Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Welcome to the Ranch.

Please be sure to use code tags when posting code to the forums. Unformatted or unindented 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 click this link ⇒ UseCodeTags ⇐ for more information.

Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vivek sri
Greenhorn

Joined: Mar 03, 2008
Posts: 4
Hi Sauris,

I found a problem in your HTML page. Please close the Input tag properly.
<input type="SUBMIT" />

It should work after that. Also, you have unclosed tags at the below locations.

Regards,
Vivek

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Unclosed tags are fine in HTML. In fact, it's technically incorrect to close them!

Unclosed tags are not the problem!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

sauris kumar saurabh wrote:the servlet is displaying the static text but is not able to fetch the value from html file

Servlets do not fetch values from HTML files. A servlet has no idea where data comes from.

Rather, the browser submits a request with request parameters created from the information in the form. If the servlet isn't showing the data you expect, then most likely the request doesn't contain the data that you think it does.

I'd install a Firefox plugin such as HttpFox so that you can inspect the request to see if it contains the submitted data or not.
Jack Ploeg
Greenhorn

Joined: Jan 08, 2010
Posts: 5
Well, maybe technically the description should be "it's not able to fetch the value that was submitted by the form in the HTML page".
I just copied your 3 listings to a web-project, ran it and it seemed OK, the message I got in the response page did mention the selected value (Got Beer Colorbrown), so the problem may be somewhere else than in the code.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: servlet Not able to fetch value from html file