Hello,
This is not a bug, I am just missing the knowledge on how to do it, I spend lots of hours on it without any good result.
Help. Thanks.
1. smartgwt 3.1 and smartclient 8.3p
2. firefox, chrome etc.
I am trying to get the variables from a javascript request made from smartclient to a servlet in a smartgwt (DMI.call), I cannot get the parameters in a format I can use... I don't know how to do it.
This calls directly to the servlet successfully. I tested it without having a requirement in the servlet and it works.
Smartclient code in javascript
smartgwt servlet
error got from log file
As said above, I want to get some parameters from the javascript layer into the servlet layer through the DMI.call.
ie.
I want to pass the customer_id to the servlet so that it prints out only the customer with the ID ie. 10
I am also interested to know how I can manipulate the JSON into Java objects or strings ie.
{some_record: { id: 1, name: "whatever", custom: true} } into a List or Map.
I am not an expert in Java.
This is not a bug, I am just missing the knowledge on how to do it, I spend lots of hours on it without any good result.
Help. Thanks.
1. smartgwt 3.1 and smartclient 8.3p
2. firefox, chrome etc.
I am trying to get the variables from a javascript request made from smartclient to a servlet in a smartgwt (DMI.call), I cannot get the parameters in a format I can use... I don't know how to do it.
This calls directly to the servlet successfully. I tested it without having a requirement in the servlet and it works.
Smartclient code in javascript
Code:
var data = { customer_id: "10"}; isc.DMI.call({ appID: "builtinapp", className: "com.whatever.printCustomer", methodName: "doGetPDF", requestParams: { actionURL: "/builtinapp/builtinapp/sc/IDACall", containsCredentials: true, downloadResult: true, data: data, downloadToNewWindow: true, }, params: ["customer_id", "10"] });
Code:
public class printCustomer extends HttpServlet { private static final long serialVersionUID = -879266760993744323L; public void doGetPDF (RPCManager manager, HttpServletResponse response) throws Exception { manager.doCustomResponse(); System.out.println(manager.getRequest().getRequestContext().request.getParameterMap().get("customer_id").toString()); }
Code:
=== 2013-05-20 23:41:01,074 [ec-1] DEBUG RPCManager - Request #1 (RPCRequest) data: { appID:"builtinapp", className:"com.whatever.printCustomer", methodName:"doGetPDF", params:[ "customer_id", "10" ], arguments:[ ], is_ISC_RPC_DMI:true } === 2013-05-20 23:41:01,074 [ec-1] INFO IDACall - Performing 1 operation(s) === 2013-05-20 23:41:01,075 [ec-1] DEBUG RPCDMI - appConfig: isc.Application.create({ rpcBindings:[ { ID:"printCustomer", className:"com.whatever.printCustomer", visibleMethods:[ { name:"doGetPDF" } ] } ] }) ... === 2013-05-20 23:41:01,075 [ec-1] DEBUG RPCDMI - Invocation threw exception java.lang.NullPointerException
As said above, I want to get some parameters from the javascript layer into the servlet layer through the DMI.call.
ie.
I want to pass the customer_id to the servlet so that it prints out only the customer with the ID ie. 10
I am also interested to know how I can manipulate the JSON into Java objects or strings ie.
{some_record: { id: 1, name: "whatever", custom: true} } into a List or Map.
I am not an expert in Java.
Comment