Re: TC 4.0 newbie - servlet app won't run (correction)
Correction, using POST results in a 405-Resource not allowed due to the HelloWorldExample servlet not implementing doPost(). Others do and work fine with POST. My apologies. At 01:02 PM 11/26/2001 -0500, you wrote: The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif
Re: TC 4.0 newbie - servlet app won't run (correction)
I will reply, Mark, in bits and drabs, as I try to figure out what you are missing and what you may have wrong. First, the servlets I referred to are not any different as servlets. They are not compiled JSP pages. The are regular old servlets. Compiled JSP page servlets are kept in tomcat/work/. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 10:15 AM Subject: Re: TC 4.0 newbie - servlet app won't run (correction) Correction, using POST results in a 405-Resource not allowed due to the HelloWorldExample servlet not implementing doPost(). Others do and work fine with POST. My apologies. At 01:02 PM 11/26/2001 -0500, you wrote: The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST
Re: TC 4.0 newbie - servlet app won't run (correction)
I have not looked at the webapps/examples except incidentally, Mark, so I am not sure how the HelloWorldExample servlet is accessed. How you access a servlet and where the servlet is are very important in these contexts. Inside and outside WEB-INF are very different, for example. Inside WEB-INF is dark to the outside world and must be accessed differently than outside WEB-INF. There must, as it were, be a portal. I still have not received answers from my last questions, which I need to go forward in my attempt to see what you may be doing. Certain answers to those questions could resolve everything. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 10:15 AM Subject: Re: TC 4.0 newbie - servlet app won't run (correction) Correction, using POST results in a 405-Resource not allowed due to the HelloWorldExample servlet not implementing doPost(). Others do and work fine with POST. My apologies. At 01:02 PM 11/26/2001 -0500, you wrote: The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url
Re: TC 4.0 newbie - servlet app won't run (correction)
Mark. I personally work on my sites at a distance, so I am presently ftping the webapps/examples to have a look at them. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 10:15 AM Subject: Re: TC 4.0 newbie - servlet app won't run (correction) Correction, using POST results in a 405-Resource not allowed due to the HelloWorldExample servlet not implementing doPost(). Others do and work fine with POST. My apologies. At 01:02 PM 11/26/2001 -0500, you wrote: The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work