Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet Not able to fetch value from html file

 
sauris kumar saurabh
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vivek sri
Greenhorn
Posts: 4
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic