This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Servlet Compilation

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am reading HF Servlets & JSP book. I am on the exercise at page 81. I am unable to compile the servlet. Compiler is unable to find javax.servlet.* package. I also set the CLASSPATH in environment variables(C:\jakarta-tomcat-5.5.5\common\lib . Can someone help me. What do I need to do to resolve this error?

Regards.
 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did u give the full path to the end...the classpath doesn't end with /lib/ .You should also include the remaining path..the jar file...that 2 lines is one whole command.
try it...
 
Suja Mudunuri
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ThankYou, I added servlet-api.jar in the CLASSPATH and it worked.

Regards
[ January 27, 2005: Message edited by: Suja Mudunuri ]
 
Suja Mudunuri
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have one more problem can U Please help me. This is the same exercise on page 81. I have my class file, HTML and web.xml in place. I am trying to run the app. I am able to see the form.html but when I click on submit query, I get this error(HTTP Status 405-HTTP method POST is not supported by this URL. I am not able to understand what I did wrong.
http://localhost:8080/Beer-v1/SelectBeer.do

type Status report

message HTTP method POST is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method POST is not supported by this URL).
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Suja,
I Think...In HTML You Are Using POST And In Servlet Source File You Are Using doGet().That Is The Reason You Are Getting The Error.Make Sure The action Attribute Value In HTMl Must Match With Corresponding doXXX() In Servlet.
Bye.
Prasad Pusapati.
 
Suja Mudunuri
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prasad,
I had a typo for dopost() instead of doPost()
Now I am getting this error. It is not able to see the class file. The actual path of the class file is C:\jakarta-tomcat-5.5.5\webapps\Beer-v1\WEB-INF\classes\com\example\web

HTTP Status 404 - /Beer-v1/com/example/web/BeerSelect

type Status report

message /Beer-v1/com/example/web/BeerSelect

description The requested resource (/Beer-v1/com/example/web/BeerSelect) is not available.


This is my web.xml
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Ch3 Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Ch3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>
</web-app>

I am not able to see what I am doing wrong. Please help.
[ January 28, 2005: Message edited by: Suja Mudunuri ]
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic