So I asked this question: 404 Not Found Error on GET/POST Request from Client to Java Servlet
And I figured it out, however, the output I am getting on the client side is a bunch of gibberish. But when I look closer, the gibberish resembles my java servlet file, so I'm getting something right; it's just formatted weird.
Anyone have any clue as to why this is happening? Am I missing something in my code or could it be something to do with the server I am utilizing?
The output should only have the following text:
some text boiii
Yet this is what I see:
1J ?( ?)?*+, -./0?*12?*3? 4 56 5789:()VCode?LineNumberTableLocalVariableTablethis?LMyTestServlet;doPostR(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)Vrequest'Ljavax/servlet/http/HttpServletRequest;response(Ljavax/servlet/http/HttpServletResponse;Exceptions;<doGettextLjava/lang/String;pwLjava/io/PrintWriter; SourceFileMyTestServlet.java != >?$MyTestServlet doGet function Invoked@ AB?some text boiii text/html CBUTF-8 DB EFG HB I?java/lang/Exception MyTestServletjavax/servlet/http/HttpServletjavax/servlet/ServletException?java/io/IOException&javax/servlet/http/HttpServletResponse?getOutputStream%()Ljavax/servlet/ServletOutputStream;!javax/servlet/ServletOutputStreamprintln(Ljava/lang/String;)V?setContentTypesetCharacterEncodinggetWriter()Ljava/io/PrintWriter;?java/io/PrintWriterwriteclose!???/ ?I +, #$ !? 6, N, , , ?:- N 14? *?+?,-.&/,01442564?#"#&?$%666&'
PS: All the source code/details is in the other question. Thanks!
change
ServletTest /ServletTest
build your project again.
find the webapps folder under c:\\tomcat\\
copy ServletTest4 folder from ..\\target\\ and paste it into the webapps\\
go bin\\ under c:\\tomcat
start tomcat by click startup.bat
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.