This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Error to import javax.servlet.*

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my source code:

This error appear in the lines:

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


How can I do to use servlet into my Galileo? I use Eclipse Galileo.

 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add servlet jar in your eclipse project class path.
 
paulo cs
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bingo!! That's right.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If yous et the "targeted runtime" to an application server (like JBoss for example), then Eclipse should pick up the vendor-provided Jar files automatically. Did you set a targeted runtime for your project?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Me too get the same error.

error at:

"import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;"


How to Add servlet jar in your eclipse project class path.?

Please help me out.
I'm a beginner.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Meenu Dharma wrote:Me too get the same error.

error at:

"import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;"


How to Add servlet jar in your eclipse project class path.?

Please help me out.
I'm a beginner.



You need to let Eclipse know that your application is going to run on your particular application server. For example, if you plan to deploy your application to JBoss Application Server, you tell Eclipse this, and Eclipse will include the proper JBoss jar files on the build path.

You do this by setting a Targeted Runtime. This is set in the Project properties. In Eclipse, go to Project -> Properties, then click on the Targeted Runtimes page. On that page, you can select the runtime (application server) your application will use.

By the way, this is actually an Eclipse (IDE) question, not a Servlet question. If you continue to have problems, you should begin your own Topic in the IDE forum.

Good luck.
 
It looks like it's time for me to write you a reality check! Or maybe a 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
    Bookmark Topic Watch Topic
  • New Topic