Hello
I tried to connect with Servlet but the I don't how!!, I searched on
tutorials to send and received data but no positive result.
this is my code ::
@Override
protected void onMain_ButtonAction(Component c, ActionEvent event) {
try {
InfiniteProgress inf = new InfiniteProgress();
Dialog progress = inf.showInifiniteBlocking();
MultipartRequest request = new MultipartRequest();
request.setUrl(
"http://127.0.0.1:7101/TestServlet-SerlvletTest-context-root/servlet1");
request.setDisposeOnCompletion(progress);
NetworkManager.getInstance().addToQueue(request);
}
catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
in the servlet, this is the content put in Header ..
{"result":[{"A":"The first"},{"B":"The second"}]}
this is code the doPost function in the servlet ::
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException
,
IOException {
//String requestParameter = request.getParameter("type");
response.setContentType(CONTENT_TYPE);
String arrayToJson = "";
arrayToJson = "{\"result\":[" +
"{\"A\":\"The first\"}," +
"{\"B\":\"The second\"}" +
"]}";
response.addHeader("result", arrayToJson);
}
How to connect and show the data, or how to send and receive data between
them..
IDE: J Developer
Desktop OS: Windows 7
My regards,,
Thanks ^_^
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/e1bb5869-1964-4dd3-9af7-fc7e9df3e513%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.