On an article, painstakingly configured the development environment, finally can happily open (Zhuang) hair (BI)
First to some wild way, do the mobile side of the development of the server to return the data has not been understood, now let's get a This bar.
According to the guidelines, you need a class to inherit Httpservelt, and then rewrite Dopost or doget to be happy to return to processing.
The rest of the thing is:
1. Write Return Data logic
Resp.setheader ("Content-type", "Text/html;charset=utf-8");
Req.setcharacterencoding ("Utf-8");
Resp.setcharacterencoding ("Utf-8");
PrintWriter out = Resp.getwriter ();
Out.write ("Information of the request");
Out.close ();
out = null;
2. Configure to allow access to the outside world
First configure this servelt: in Web.xml file modification
<!--give this servelt first name-->
<servlet>
<servlet-name>TestServelt</servlet-name>
<servlet-class>com.test.c_171030.TestServelt</servlet-class>
</servlet>
<!-- And then, according to the alias, configure him to go out.-->
<servlet-mapping>
<servlet-name>TestServelt</servlet-name>
<url-pattern>/myServelt</url-pattern>
</servlet-mapping>
Originally Tomcat's Access interface was 8080, replacing 8080 with HTTP's default 80 port, modifying the Server.xml file
<!--Modify the default request Port-->
<connector connectiontimeout= "20000" port= "protocol=" http/1.1 "redirectport=" 8443 "
uriencoding=" UTF-8 "
/>