回复: Java Applet can not communicate with Java Servlet

2013-04-30 Thread qingtao peng
Have you any document for me to consult?



 发件人: Christopher Schultz ch...@christopherschultz.net
收件人: Tomcat Users List users@tomcat.apache.org 
发送日期: 2013年4月29日, 星期一, 11:01 下午
主题: Re: Java Applet can not communicate with Java Servlet
 

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Peng,

On 4/29/13 10:05 AM, qingtao peng wrote:
 uc.setRequestProperty(Content-type,application/xwww-form-urlencoded);

I
 
think you want:

application/x-www-form-urlencoded

 res.setContentType(text/html;charset=GB2312);

Why not use UTF-8 like you did in the Applet? What you have done is
not wrong and it should work, but it does seem a little odd to use
different character encodings in different places.

 I have started the apache-tomcat-7.0.32 server ,then I have typed
 the network address of DbApplet.htm in the  address field of the 
 browser.I click on the button in the Applet,but  receive 
 java.io.FileNotFoundException error.The error is 
 java.io.FileNotFoundException: 
 http://localhost:8080/Servlet/DbServlet.Where do I place DbServlet
 ?

The servlet spec says that all servlets need to be in a package. So
you should have a package statement at the top of your .java file,
then re-compile.

 That is, which directory  do I place under in
 apache-tomcat-7.0.32.

Assuming your package is my.pkg, then you want your .class file here:

.../mywebapp/WEB-INF/classes/my/pkg/DbServlet.class

 What is the network address of this Servlet .I thank for helps.

Network address (hostname) will be wherever you configured Tomcat to
listen (localhost? www.foo.com?). The URL will depend upon how you
have mapped the servlet in web.xml. Have you done that?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRfotFAAoJEBzwKT+lPKRYOLMP/0XuXo5m06m6cXUfv90Ngh+U
Vpy4L9y8WCWpHthtJqxk4EDRLT1K0Y5hV6cW0S7BzeH9ynh2VaKVvcWMR3KPcwts
Pc60/TUMj7qGLzXkTfBxxUnWGzY6fQLq4KRJdiHDQvycnw/KwYbM1FjDU9PjG2vi
yeEZQhEqMrP+fHCq8bYLAH+nuqngIGt59HGlN+1Umz5rsguSu6uq/ymaXUYEzyXZ
k1lqDwKSTGn7x4LD+AOqzJxH549bMjFVqexE5Fw4yFCfxChAP7zQwnDhL1jkKcsB
TXZJKQ5wNqQmHYg/C/9Cf+jKg7wmF6nEyw3FB4zDcYhKnGXaBBq2S8zF61Y8wKq3
QPkbyMfC8zPivXC1Jx28TyDJVQ81SLyKGB9JYfLZSuGvpN3rEV5sXOVrwKZw4+D7
mRYrwCYshm2/ueFALPXEjZbbAQHiXSqISDSdiMxYbIazMOCgxwcWcBfh7Rd2/g5+
rWU/xDdM0rUaIEkRVfA5bVQg9zNOqqoZFe7aEFNlBK0Y02LY2G9Bi2VtrfVMVnHo
gXxf0efIn7fyI9ajsh1JFm/f+NxKvZissEPqDRr7pWV0qyqcr8YfErrPT6jYMPl9
lGSF2RIFXO2zaxJ2x6pwnLxWl/EYXxayFPqoCQXTw3lBRLaCeVG+Ftw+l8ni+Gm7
aIzoBlfT46MVINdwePvB
=UAT7
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Re: 回复: Java Applet can not communicate with Java Servlet

2013-04-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Peng,

On 4/30/13 10:15 AM, qingtao peng wrote:
 Have you any document for me to consult?

Please don't top-post.

Were my responses helpful? I'm not sure you need any document to
consult, though you probably should read the Servlet Specification.
It's quite readable.

- -chris

  发件人: Christopher Schultz
 ch...@christopherschultz.net 收件人: Tomcat Users List
 users@tomcat.apache.org 发送日期: 2013年4月29日, 星期一, 11:01 下午 主题: Re:
 Java Applet can not communicate with Java Servlet
 
 
 Peng,
 
 On 4/29/13 10:05 AM, qingtao peng wrote:
 uc.setRequestProperty(Content-type,application/xwww-form-urlencoded);

 
 I
 
 think you want:
 
 application/x-www-form-urlencoded
 
 res.setContentType(text/html;charset=GB2312);
 
 Why not use UTF-8 like you did in the Applet? What you have done
 is not wrong and it should work, but it does seem a little odd to
 use different character encodings in different places.
 
 I have started the apache-tomcat-7.0.32 server ,then I have
 typed the network address of DbApplet.htm in the  address field
 of the browser.I click on the button in the Applet,but  receive 
 java.io.FileNotFoundException error.The error is 
 java.io.FileNotFoundException: 
 http://localhost:8080/Servlet/DbServlet.Where do I place
 DbServlet ?
 
 The servlet spec says that all servlets need to be in a package.
 So you should have a package statement at the top of your .java
 file, then re-compile.
 
 That is, which directory  do I place under in 
 apache-tomcat-7.0.32.
 
 Assuming your package is my.pkg, then you want your .class file
 here:
 
 .../mywebapp/WEB-INF/classes/my/pkg/DbServlet.class
 
 What is the network address of this Servlet .I thank for helps.
 
 Network address (hostname) will be wherever you configured Tomcat
 to listen (localhost? www.foo.com?). The URL will depend upon how
 you have mapped the servlet in web.xml. Have you done that?
 
 -chris
 
 -

 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRf9r+AAoJEBzwKT+lPKRY7n4QAKd9JFL5NXpjukyS5zgq4jni
QfrRiAooLl/2OQuO6II3TM7sYMEZFOM6b0eVhYUpeaguXFVqXslEANaEbkY2+Ng3
a/b+sPB2Nx7yszv4qtRbbR4uge/YzUJ1pYmtqDtMDXU7qeh3zjdEkSqgM76CXfjh
8a1gPjXFkjeoFCvdf0wUwZI0C8tChvWK33omAAFvmoQSqYKQcHSXVi7gIKf+wYcs
Sq+4oy//LZnegGLON/LqH2CAbBblPw3vd/eaGVmDcavtSpvz0rBc2bis7R6ejpjx
s54dN+doJSrZfaQPqC4RfpeFubdvPpwW5OEKWzPNZ/UhrnZ4/nx/RPDwDdRkZOyF
l9RxPH2i4xY6n0HUNIg+EaQPXzdsPkH45/6hNz+2uOeeJc4u7DFZHT2ieF8ATt4T
JfrcsNdIgvvvht/shXOL+8ebbql7Azudtv2PXBWgs4AxIzj4sO6cschmKKgNzc+A
p6DGi/TMlsiMHlt/DqKND66UZHNete9hTwkeQsfuEpnL6Lb6QfSPOZePirCBx4Se
yFLPExKmNYDWWrAvIJMDPyEhDzHapO1n1uvXCvv5Iw9hw0BhfVtr3a4MTVyVGE9n
J7nhwtT5kvExUGSm+BVEUOpxcvsYgtN3kInRU9HsinPC8s3DLz4rb0TNZtnBM6ml
Xe3z87i4JLKr28g5kyMK
=glbJ
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org