473,395 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

help me in compling this code

19
hi
iam trying to complie this code
Expand|Select|Wrap|Line Numbers
  1. import javax.servlet.*;
  2. import javax.servlet.http.*;
  3. import java.util.*;
  4. import java.sql.*;
  5.  
  6. public class MainServlet extends HttpServlet {
  7.  
  8.     RequestDispatcher dis = null;
  9.  
  10.     public void doPost(HttpServletRequest req,HttpServletResponse resp) {
  11.  
  12.         resp.setContentType("text/html");
  13.         String action = req.getParameter("submit");
  14.         Dispatcher dis = null;
  15.         try {
  16.  
  17.             if (action.equalsIgnoreCase("login")) {
  18.                 System.out.println("login invoked");
  19.                 loginAction(req, resp);
  20.             }
  21.  
  22.         }catch(Exception e){
  23.         }
  24.     }
  25.  
  26.     private void loginAction(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException
  27.     {
  28.         System.out.println("Accounts Button Clicked");
  29.         //System.out.println("Hash table values "+ht);
  30.         dis= req.getRequestDispatcher("/home.html");
  31.         if (dis != null) {
  32.  
  33.             // forward request to next page
  34.             dis.forward(req, resp);
  35.         }
  36.     }
  37. }            
  38.  
Iam getting an error saying
package javax.servlet.http does not exist
please help in compileing the code
Iam begginer to servlets concept
Mar 20 '07 #1
14 1836
dmjpro
2,476 2GB
most probably the specific library missing .....
Mar 20 '07 #2
r035198x
13,262 8TB
hi
iam trying to complie this code
Expand|Select|Wrap|Line Numbers
  1. import javax.servlet.*;
  2. import javax.servlet.http.*;
  3. import java.util.*;
  4. import java.sql.*;
  5.  
  6. public class MainServlet extends HttpServlet {
  7.  
  8.     RequestDispatcher dis = null;
  9.  
  10.     public void doPost(HttpServletRequest req,HttpServletResponse resp) {
  11.  
  12.         resp.setContentType("text/html");
  13.         String action = req.getParameter("submit");
  14.         Dispatcher dis = null;
  15.         try {
  16.  
  17.             if (action.equalsIgnoreCase("login")) {
  18.                 System.out.println("login invoked");
  19.                 loginAction(req, resp);
  20.             }
  21.  
  22.         }catch(Exception e){
  23.         }
  24.     }
  25.  
  26.     private void loginAction(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException
  27.     {
  28.         System.out.println("Accounts Button Clicked");
  29.         //System.out.println("Hash table values "+ht);
  30.         dis= req.getRequestDispatcher("/home.html");
  31.         if (dis != null) {
  32.  
  33.             // forward request to next page
  34.             dis.forward(req, resp);
  35.         }
  36.     }
  37. }            
  38.  
Iam getting an error saying
package javax.servlet.http does not exist
please help in compileing the code
Iam begginer to servlets concept
Have you installed the j2ee compiler?
Mar 20 '07 #3
bhanu08
19
Have you installed the j2ee compiler?
no i installed only jdk1.5 can u please tell where can i get the J2EE n how to comple the code
Mar 20 '07 #4
r035198x
13,262 8TB
no i installed only jdk1.5 can u please tell where can i get the J2EE n how to comple the code
You can download it from here
Mar 21 '07 #5
bhanu08
19
You can download it from here
thanx for ur reply
can u please tell me after downloading what should i do
Mar 21 '07 #6
r035198x
13,262 8TB
thanx for ur reply
can u please tell me after downloading what should i do
Follow the installation instructions. Make sure you also downloaded a server for deploying your applications from.
Mar 21 '07 #7
bhanu08
19
Follow the installation instructions. Make sure you also downloaded a server for deploying your applications from.
ya i had installed tom cat will tht be ok.
Mar 21 '07 #8
r035198x
13,262 8TB
ya i had installed tom cat will tht be ok.
Yes. Tomcat is fine.
Mar 21 '07 #9
bhanu08
19
Yes. Tomcat is fine.
i installed j2ee n tomcat it still says

package javax.servlet does not exist


what to do sir ??
plz help me
Mar 21 '07 #10
r035198x
13,262 8TB
i installed j2ee n tomcat it still says

package javax.servlet does not exist


what to do sir ??
plz help me
I hope you are not using javac from the SDK to compile the servlet.
Mar 21 '07 #11
i installed j2ee n tomcat it still says

package javax.servlet does not exist


what to do sir ??
plz help me
Before compile put the servlet.jar in your class path.
Mar 21 '07 #12
bhanu08
19
I hope you are not using javac from the SDK to compile the servlet.
in the command prompt iam going to the path

C:\Sun\AppServer\jdk\bin>

where my java is installed

and giving command as

javac MainServlet.java

package javax.servlet does not exist error is coming

i had installed J2ee i want know the use of it
Mar 21 '07 #13
bhanu08
19
Before compile put the servlet.jar in your class path.
in the command prompt iam going to the path

C:\Sun\AppServer\jdk\bin>

where my java is installed

and giving command as

javac MainServlet.java

package javax.servlet does not exist error is coming

i had installed J2ee i want know the use of it

wherer can i find servlet.jar file and
how shud i have to put servlet.jar the class path ??
Mar 21 '07 #14
r035198x
13,262 8TB
in the command prompt iam going to the path

C:\Sun\AppServer\jdk\bin>

where my java is installed

and giving command as

javac MainServlet.java

package javax.servlet does not exist error is coming

i had installed J2ee i want know the use of it

wherer can i find servlet.jar file and
how shud i have to put servlet.jar the class path ??
here is an article on how to set the class path.
Mar 21 '07 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Rama krishna | last post by:
Hi All: I got the same problem what u got. Could u pls explain me hoe can i proceed. I saw some sites on this issue, which actually not worked with me. Iam using System.Directoryservices dll in...
1
by: yanwan | last post by:
Hello I am now compling a project, but in one source file of this project, I met this problem. It seems very strange. Below is this source file: ----------------------------------------...
3
by: Chris | last post by:
Hi, I am trying to follow the same structure as the MS Application Blocks for my local stuff. I am trying to create an application block to process payments which I'll hand out to other developers...
5
by: shiling zhang | last post by:
I have a C program that is complied fine under DOS and UNIX. However, the same C program has the following compling error under IBM 390. TIA. ...
4
by: yanwan | last post by:
Hello I am now compling a project, but in one source file of this project, I met this problem. It seems very strange. Below is this source file: ----------------------------------------...
3
by: gokhan Can | last post by:
Is it possible to compile a web application code from command prompt instead of .Net Framework?? If it is how can I do this ?? Gökhan Can
1
by: SSW | last post by:
Hi! I want to include .JS(JavaScript file) to my aspx file. I used the following tag. <script language="javascript" src="Utility.js" type="text/javascript"> After compling my page and...
10
by: gshy2014 | last post by:
Hi, all. IN Windows, TCHAR is translated to be wchar or char according to whether UNICODE is defined. Dose the complier handle the UNICODE(define or not define) according to the OS ? Many...
6
by: Christian Heimes | last post by:
inhahe schrieb: I assume you are trying to compile Python 2.5 with VS 9.0. It's not supported. Some extensions don't compile under VS 9.0 Christian
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.