Dear Sirs,
Thank you for your replying. I would like to explain my questions in detail.
-----------------------
Eclipse 3.6(Helios)
Tomcat 7.0.14
Servlet 3.0
Windows XP SP3 x86 version
------------------------
What is the result? Is this webapp deployed into the /test context path?
A browser showed the error message of HTTP status 404, which indicated that
the requested resource(/test/hello) is not available.
On "Package Explorer" of Eclipse, the file system is showed as follows:
--------------------
test
+--- WEB-INF/src
| +--- servlets
| +--- HelloServlet.java
+--- sample.txt
--------------------
Yes. This webapp is devployes into the /test context path because I
confirmed the following two points.
First, I checked that \apache-tomcat-7.0.14\conf\Catalina\localhost\test.xml
is existed and that "<Context path="/test"........../>" is described in
test.xml.
Second, I tested that /test context path is workable with calling
"http://localhost:8080/test/sample.txt" on a browser. It is OK.
A different file name, or a different "name" attribute chosen in the
@WebServlet annotation? The former makes no sense, while the latter
makes perfect sense.
On "Package Explorer" of Eclipse, the file system is showed as follows:
--------------------
ex3
+--- WEB-INF/src
| +--- input
| | +--- GuessServlet.java
| +--- input2
| +--- GuessServlet.java
+--- input
| +--- guess.jsp
+--- input2
+--- guess.jsp
--------------------
"GuessServlet.java" of input2 package and "guess.jsp" of input2 package
revise specification of each input package.
In this case, "@WebServlet" annotation was not available under the different
"urlPatterns".
------------
package:input
file name:GuessServlet.java
@WebServlet(name="GuessServlet", urlPatterns={"/guess"})
public class GuessServlet extends HttpServlet {
------------
package:input2
file name:GuessServlet.java
@WebServlet(name="GuessServlet", urlPatterns={"/guess2"})
public class GuessServlet extends HttpServlet {
------------
In JSP, url pattern is as follows:
------------
folder:input
file name:guess.jsp
<FORM ACTION="../guess">
------------
folder:input2
file name:guess.jsp
<FORM ACTION="../guess2">
------------
As a resutlt,a browser showed the error message of HTTP status 404.
Then, a file name was changed.On "Package Explorer" of Eclipse, the file
system is showed as follows:
--------------------
ex3
+--- WEB-INF/src
| +--- input
| +--- GuessServlet.java
| +--- GuessServlet2.java
+--- input
+--- guess.jsp
+--- guess2.jsp
--------------------
In this case, "@WebServlet" annotation was available under the different
"name and "urlPatterns" as follows:
------------
package:input
file name:GuessServlet.java
@WebServlet(name="GuessServlet", urlPatterns={"/guess"})
public class GuessServlet extends HttpServlet {
------------
package:input
file name:GuessServlet2.java
@WebServlet(name="GuessServlet2", urlPatterns={"/guess2"})
public class GuessServlet2 extends HttpServlet {
------------
In JSP, url pattern is as follows:
------------
folder:input
file name:guess.jsp
<FORM ACTION="../guess">
------------
folder:input
file name:guess2.jsp
<FORM ACTION="../guess2">
------------
Can you explain this in more detail? I do not understand.
On "Package Explorer" of Eclipse, the file system is showed as follows:
--------------------
basic
+--- WEB-INF/src
| +--- reqattr
| +--- GuessServlet.java
+--- reqattr
+--- guess_hit.jsp
+--- guess.jsp
--------------------
In this case, "@WebServlet" annotation is as follows:
------------
package:reqattr
file name:GuessServlet.java
@WebServlet(name="GuessServlet", urlPatterns={"/guess"})
public class GuessServlet extends HttpServlet {
------------
In JSP, url pattern is as follows:
------------
folder:reqattr
file name:guess.jsp
<FORM ACTION="../guess">
------------
I would like to explain a flow of three programs above Eclipse file system.
First, A browser calls "http://localhost:8080/basic/reqattr/guess.jsp".
Second, "guess.jsp" calls "/reqattr/GuessServlet.java" by inputing a
charactor. In this servlet program, depending on a answer, a return path is
branched into two paths.
Third, two path are brabched depending on a answer. One is
"/reqattr/guess.jsp". Another is "/reqattr/guess_hit.jsp". The branch
control is done by "RequestDispatcher dispatcher =
request.getRequestDispatcher(path);".
Forth, "GuessServlet.java" can return to "guess.jsp" or "guess_hit.jsp".
Fifth, "guess.jsp" can call "/reqattr/GuessServlet.java" by inputing a
charactor, again.
Sixth, Here, a browser showed the error message of HTTP status 404, which
indicated that the requested resource(/guess) is not available.
A program of file upload with "@WebServlet" and "@MultipartConfig" is
successfully workable in my environment. So far, I would like to ask you a
technique to follow the specification of Servlet 3.0. Or is Tomcat 7.0.14
under the implementation of the specification on Servlet 3.0?
Best Wishes,
---------------------------------------
Noriko Etani
Kobe Institute of Computing, Japan
Email:et...@kic.ac.jp/kero...@kcn.ne.jp
---------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org