I have redhat9,Apache2,Tomcat4.1.30,jdk1.2.2. I use webapp as connector between APache and Tomcat.
I can view means Apache is running
I can view the servlet example from Tomcat.
Then I put my own hello.class at $CATALINA_HOME/webapps/examples/WEB-INF/classes, the same place as HelloWorldExample.class.
I try:
it didn't show the Hello message but ask me to download the file.
What shall I do? Please advise!!!!
I check the /webapps/examples/WEB-INF\web.xml, it has
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
The followign is my own hello.class.
import...
public class hello extends HttpServlet{
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException{
PrintWriter output;
res.setContentType("test/html");
output=res.getWriter();
output.println("<HTML><HEAD><TITLE>Hello</TITLE></HEAD>");
output.println("<BODY>");
output.println("Hello Test");
output.println("</BODY></HTML>");
}
}
I can view means Apache is running
I can view the servlet example from Tomcat.
Then I put my own hello.class at $CATALINA_HOME/webapps/examples/WEB-INF/classes, the same place as HelloWorldExample.class.
I try:
it didn't show the Hello message but ask me to download the file.
What shall I do? Please advise!!!!
I check the /webapps/examples/WEB-INF\web.xml, it has
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
The followign is my own hello.class.
import...
public class hello extends HttpServlet{
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException{
PrintWriter output;
res.setContentType("test/html");
output=res.getWriter();
output.println("<HTML><HEAD><TITLE>Hello</TITLE></HEAD>");
output.println("<BODY>");
output.println("Hello Test");
output.println("</BODY></HTML>");
}
}