





CodePudding user response:
The server-side codeProtected void doGet (it request, HttpServletResponse response)
Throws ServletException, IOException {
The response. SetContentType (" application/json; charset=utf-8");
Request. SetCharacterEncoding (" utf-8 ");
The response. SetCharacterEncoding (" utf-8 ");
PrintWriter out=response.getWriter();
//get the request of the user name and password
String username=request. The getParameter (" username "). The trim ();
List
The User the User;
JSONObject a=new JSONObject ();
for(int i=0; i
String classname=user. Getclassname ();
String coursename=user. Getcoursename ();
String num=user. Getnum ();
String requested=user. Getrequested ();
Amy polumbo ut (" username ", username);
Amy polumbo ut (" classname ", the classname);
Amy polumbo ut (" coursename ", coursename);
Amy polumbo ut (" num ", num);
Amy polumbo ut (" requested ", requested);
Out=response. GetWriter ();
Out.println (a);
}
}
CodePudding user response:
The android client codeRequestQueue mQueue=Volley. NewRequestQueue (MainActivity. This);
JsonObjectRequest JsonObjectRequest=new JsonObjectRequest (jsonurl, null, new Response. Listener
@ Override
Public void onResponse (JSONObject response) {
Try {
String classname.
String coursename;
The classname=new String (new String (response. Get String (" classname ")));
Coursename=new String (new String (response. Get String (" coursename ")));
The classname=new a classname (classname, coursename);
System. The out. Println (coursename);
ClassnameList. Add (a);
Adapter Adapter=new Adapter (classnameList);
RecyclerView. SetAdapter (adapter);
} the catch (JSONException e) {
The e (" json error ", um participant etMessage ());
}
}
},
CodePudding user response:
Have to solve the problem!!!!!!!!!!!!!!!!!!!!!!!CodePudding user response:
Figure all paste QAQ.But I want to know how to receive
CodePudding user response:
I just want to have a look at figure,,,,