john way

Greenhorn
+ Follow
since Oct 29, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by john way

I do have one question. Somehow, I added the service() method to my servlet as well as two of the sample servlets - LookupSign and LeapYear. Any idea what "button" I pushed?
------------------
John
22 years ago
That did the trick. Thank you very much!! I did have the code in both projects, now they both work fine and I can proceed to try more difficult task.

------------------
John
22 years ago

Originally posted by Kyle Brown:
[B]The fact that you haven't mentioned what Project your servlet is in makes me believe that the source code isn't in VAJ. Is this true? How did you create this servlet, and what project did you create it in? Did you then add that project to the classpath of the WTE?
Yes, I have done all the above. I created a project called JohnsProject and added that project to the classpath using the WTE control center.
The next thing I tried was to create a new package in the IBM JSP Examples project called com.ibm.ivj.wte.samples.johnway I created a new servlet, cut out the auto generated code and pasted my HelloWorld code (shown in original post)into this new class (with the same name)
when I called the URL from my browser with http://localhost:8080/servlet/com.ibm.ivj.wte.samples.johnway.HelloWorld I get a blank email page. View-Source gives me the following
< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
Which is obviuosly not what I programmed, but it is something. Any thoughts on what I need to do to get the desired output programmed in HelloWorld?
------------------
John

22 years ago
Is anyone familiar with VisualAge Java 4.0? I am trying to get a simple Hello World servlet to run on the Websphere Test Environment.
- The sample servlets run fine
- I have placed the following code in the default_app/servlets/sampleservlets subdirectory (This servlet was created in the sampleservlets package in VAJava):
package sampleservlets;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* Insert the type's description here.
* Creation date: (10/26/2001 3:04:49 PM)
* @author: Administrator
*/
public class HelloWorld extends HttpServlet {
/**
* HelloWorld constructor comment.
*/
public HelloWorld() {
super();
initialize();
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello World");
}
/**
* Called whenever the part throws an exception.
* @param exception java.lang.Throwable
*/
private void handleException(java.lang.Throwable exception) {
/* Uncomment the following lines to print uncaught exceptions to stdout */
// System.out.println("--------- UNCAUGHT EXCEPTION ---------");
// exception.printStackTrace(System.out);
}
/**
* Initialize the class.
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initialize() {
try {
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
// user code begin {2}
// user code end
}
/**
* main entrypoint - starts the part when it is run as an application
* @param args java.lang.String[]
*/
public static void main(java.lang.String[] args) {
try {
HelloWorld aHelloWorld;
aHelloWorld = new HelloWorld();
} catch (Throwable exception) {
System.err.println("Exception occurred in main() of javax.servlet.http.HttpServlet");
exception.printStackTrace(System.out);
}
}
/**
* service method comment.
*/
public void service(javax.servlet.ServletRequest arg1, javax.servlet.ServletResponse arg2) throws javax.servlet.ServletException, java.io.IOException {}
}

When I try to run the servlet, using http://localhost:8080/servlet/sampleservlets/HelloWorld, I get the following message:
Message: Server caught unhandled exception from servlet [invoker]: Servlet [sampleservlets]: Could not find required servlet class - sampleservlets.class

ANY THOUGHTS??
------------------
John
22 years ago