• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

servlet not working

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have run a html file, as below

<html>
<body>
<h1 align="center"> Chicken selection</h1>
<form method="POST" action="SelectChicken.do">
Select chicken type


Type:
<select name="chicken" size="1">
<option>Tandoori
<option>Tikka
<option>Hyderabadi
<option>Butter Masala
<option>Chilly
</select><input type="SUBMIT">



<!--
<center>
<input type="SUBMIT">
</center>
-->
</form>
</body>
</html>


I also have compiled the ChickenSelect.java file, and placed it in webapps/WEB-INF/classes//com/example/web folder

without the web.xml file the form.html file is running. but as soon as I paste the web.xml file in the WEB-INF folder and run the html file it does not run anymore. Please help, have been stuck here for a long time. The following is the web.xml file

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<servlet>
<servlet-name>cc</servlet-name>
<servlet-class>com.example.web.ChickenSelect</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>cc</servlet-name>
<url-pattern>/SelectChicken.do</url-patter>
<servlet-mapping>

</web-app>

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your web.xml is wrong.

You have not closed <servlet-mapping> properly and spell mistake in </url-pattern>

Below is the correctd one.

<servlet-mapping>
<servlet-name>cc</servlet-name>
<url-pattern>/SelectChicken.do</url-pattern>
</servlet-mapping>

Restart your server and check it out.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chan,

It is always recommended to check logs for any issues while running web apps. You would have errors in log file for such issue.
 
chan kgp
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, it worked
Thank you very much, cant believe it was a typo
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic