473,609 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deploying servlet class file from webapp/ROOT/WEB-INF

6 New Member
After compiling the servlet program when i put the class file in ROOT/WEB-INF/classes folder...and through internet explorer by using url http://localhost:8080/servlet/Demo error shows sourse not found...

but when i put the class file in examples/WEB-INF/classes folder and by editing the web.xml file(describing the servlet name and mapping) program runned....but by changing the ROOT/WEB-INF/web.xml file similarly error shows...

Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2. import javax.servlet.*;
  3. import javax.servlet.http.*;
  4. import java.util.*;
  5.  
  6. public class Demo extends HttpServlet
  7. {
  8.     public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
  9.     {
  10.         res.setContentType("text/html");
  11.         PrintWriter out = res.getWriter();
  12.  
  13.         Enumeration hnames = req.getHeaderNames();
  14.         out.println("<H3> The request headers are: </H3>");
  15.         while (hnames.hasMoreElements())
  16.         {
  17.             String hname = (String)hnames.nextElement();
  18.             Enumeration hvalues = req.getHeaders(hname);
  19.             out.println("<BR>");
  20.  
  21.             if (hvalues != null) ;
  22.             {
  23.                 while (hvalues.hasMoreElements())
  24.                 {
  25.                     String hvalue = (String)hvalues.nextElement();
  26.                     out.println(hname + ":" + hvalue);
  27.                 }
  28.             }
  29.  
  30.         }
  31.     }
  32. }
  33.  
Jul 14 '10 #1
1 2867
iohos
45 New Member
corroborate wid d following dynamic servelet

Expand|Select|Wrap|Line Numbers
  1. import java.io.*;    
  2. import javax.servlet.*;    
  3. import javax.servlet.http.*;    
  4. import java.util.Date;    
  5.  
  6. public class Time extends HttpServlet {    
  7.  public void doGet(HttpServletRequest req, HttpServletResponse rsp)    
  8.                throws ServletException, IOException {    
  9.    rsp.setContentType("text/html");    
  10.    PrintWriter out = rsp.getWriter();    
  11.  
  12.    Date now = new Date(); // The current date/time    
  13.  
  14.    out.println("<html>");    
  15.    out.println("<head><title> Time Check </title></head>");    
  16.    out.println("<body>");    
  17.    out.println("<p>The time is: " + now + "</p>");    
  18.    out.println("</body></html>");    
  19.  }    
  20. }
u r making errors in variable defining
Jul 25 '10 #2

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

Similar topics

6
3175
by: alan | last post by:
Dear all, I have a servlet problem. When I modified my java servlet program and then uploaded it to my web hosting server, then I start my web browser(I.E) to see the result. But it loaded the previous java servlet class program. After several days, these new classes file can be refreshed on browser. I want to know how I can make sure I always see the most update
1
1725
by: Erich | last post by:
Hi, everybody! I would like my WebApp (ASP.NET) writes a text-file in my Web Host, so I could download it and import it to another application. Does anybody know how can I write a text file in my Web Host? My Web Host is HostBasket.
2
3065
by: a | last post by:
I keep getting this message, "unable to get the project file from the web server" when I try to open a new project that I just copied. I created a virtual director with IIS 5 (VS2002). Trying to setup Rainbow. Suggestions? Thanks, Andy ac411@bellsouth.net
3
2144
by: Andrew | last post by:
Hi all, I am still learning ASP.Net, and .Net in general. Though I feel I have much of the "basics" down, I am running into some gray areas in more advanced topics. My question is how I make sure that a class file (DLL) I wrote and am using (via "Add Reference") on my development webserver still works correctly when I copy all my files over to the production server. Do I need to create the same folders on the production server as on...
3
2205
by: Jiong Feng | last post by:
Hi, I have a question. WE have a web application in web root. And also we have a virtual directory library application. If we change root web.config, the root application will restart. But, is that possible not restart the virtual directory application?
2
1628
by: EO | last post by:
I have much of what I need, but would appreciate a sanity check and I have some hopefully easy questions. (Easy for YOU, that is!) I have a website with about 2000 pages to convert to .net. (prime candidate for aspx headers/footers, etc. - eh?) There's a development copy on my local W2kS box and a live copy on a web server on a shared host through a web hosting service. Local host environment: I'm trying to get vs.net to provide me...
7
6161
by: dinamointer | last post by:
Could you help me in this problem: I want to launch an exe file(executable jar file) from a web page. I use jsp...and i cannot use vbScript...? could u tell me how should i do it? Thanks
6
1999
by: Jim Butler | last post by:
I started to struggle with this recently. We have already crossed the inheritance issue with root web's/assemblies and so on from the web.config (ie we are using the remove assembly attribute in sub webs). Anyway, we have upgraded our main root site to .net 2.0. We have a few other apps under the root that are 1.1 and started reporting this error. Configuration Error Description: An error occurred during the processing of a...
0
5007
by: bharathreddy | last post by:
Here I will given an example on how to access the session, application and querystring variables in an .cs class file. Using System.Web.HttpContext class. 1) For accesing session variables : System.Web.HttpContext.Current.Session 2) For accesing Application variables : System.Web.HttpContext.Current.Application 3) For accesing QueryString variables : System.Web.HttpContext.Current.Request.QueryString Here is a simple example where...
2
3304
by: Reggie | last post by:
Hi and TIA! I have a class file located in my root directory with all me web pages. I call/use the class and it works fine. I have no imports statements aspx or codebehind. My question is why? I thought the class file had to be compiled and placed in the bin directory or added to the App_Code(as a class file) folder. I don't have it in either it's simply in the root. Now When I compile it and place the dll in the bin and remove the...
0
8579
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8555
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8232
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7024
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5524
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4032
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4098
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.