80,351
社区成员
发帖
与我相关
我的任务
分享
findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
new Thread(new Runnable(){
public void run() {
mHand.post(new Runnable() {
public void run() {
System.out.println(txt_Fuwiqi1.getText());
if(txt_Fuwiqi1.getText().toString().trim().equals("Dao")){
reder.rederNet("http://192.168.69.183:8080/myhttpGetPost/Dao?name="+txt_name1.getText(), txt1);
}else if(txt_Fuwiqi1.getText().toString().trim().equals("Re_Str")){
reder.rederNet("http://192.168.69.183:8080/myhttpGetPost/Re_Str?name="+txt_name1.getText(), txt1);
}else{
Toast toast=Toast.makeText(getApplicationContext(),"请添加服务器名字!!!",Toast.LENGTH_LONG );
toast.show();
}
}
});
try {
Thread.sleep(8000);
} catch (InterruptedException e) {
e.printStackTrace();
Toast t=Toast.makeText(getApplicationContext(), "服务器无法响应!", Toast.LENGTH_LONG);
t.show();
}
}
}).start();
}
});
findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
new Thread(new Runnable() {
public void run() {
mHand.post(new Runnable() {
public void run() {
System.out.println(txt_Fuwiqi2.getText());
if(txt_Fuwiqi2.getText().toString().trim().equals("Dao")){
reder.rederNet("http://192.168.69.183:8080/myhttpGetPost/Dao?name="+txt_name2.getText(),txt2);
}else if(txt_Fuwiqi2.getText().toString().trim().equals("Re_Str")){
reder.rederNet("http://192.168.69.183:8080/myhttpGetPost/Re_Str?name="+txt_name2.getText(),txt2);
}else{
Toast toast=Toast.makeText(getApplicationContext(),"请添加服务器名字!!!",Toast.LENGTH_LONG );
toast.show();
}
}
});
try {
Thread.sleep(8000);
} catch (InterruptedException e) {
e.printStackTrace();
Toast to=Toast.makeText(getApplicationContext(), "服务器无法响应!", Toast.LENGTH_LONG);
to.show();
}
}
}).start();
}
});
1.
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getOutputStream().println("This is result is Get"+" "+request.getParameter("name"));
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getOutputStream().println("This is result is post"+" "+request.getParameter("name"));
}
2.protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Re_String str=new Re_String();
String name=str.name(request.getParameter("name").toString())+"123";
response.getOutputStream().println(name);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Re_String str=new Re_String();
String name=str.name(request.getParameter("name").toString());
response.getOutputStream().println(name);
}