I have the following DynamicForm which I am using as a login screen.
Here is the datasource
And here is the sample json
When I click the submit button on the form, I see this in FF
http://127.0.0.1:8888/webtools/sc/IDACall "404 Not Found"
On the GWT console I see an error
[ERROR] [webtools] - 12:25:11.912:XRP0:WARN:RPCManager:Server returned TRANSPORT_ERROR with no error message., response: {status: -90,
data: Obj,
httpResponseCode: 404,
transactionNum: 1,
clientContext: Obj,
context: Obj,
startRow: 0,
endRow: 0,
totalRows: 0}
Code:
public class LoginForm extends DynamicForm { public LoginForm() { TextItem user = new TextItem("name", "Username"); PasswordItem password = new PasswordItem("password", "Password"); SubmitItem submit = new SubmitItem("login", "Login"); setFields(user, password, submit); setDataSource(UserDatasource.getInstance()); setSaveOnEnter(false); setCanSubmit(false); } @Override public void saveData() { Criteria criteria = new Criteria(); criteria.addCriteria("name", getValueAsString("name")); criteria.addCriteria("password", getValueAsString("password")); //this json is static data for test purpose ((RestDataSource) getDataSource()).setFetchDataURL("webtools/data/login.data.json"); ((RestDataSource) getDataSource()).fetchData(criteria, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { // do something } }); } }
Code:
public class UserDatasource extends RestDataSource { private static UserDatasource instance = null; public static UserDatasource getInstance() { if (instance == null) { instance = new UserDatasource("usersDS"); } return instance; } public UserDatasource(String id) { setID(id); setDataFormat(DSDataFormat.JSON); setTitleField("name"); setDataProtocol(DSProtocol.POSTPARAMS); setCacheAllData(false); //several fields are defined and added } }
Code:
{ response:{ status:0, startRow:0, endRow:1, totalRows:1, data:[ { userId: 999, name: "admin", password: "admin", reportsTo: 1, role: "System Administrator", phone: "900000000000" } ] } }
http://127.0.0.1:8888/webtools/sc/IDACall "404 Not Found"
On the GWT console I see an error
[ERROR] [webtools] - 12:25:11.912:XRP0:WARN:RPCManager:Server returned TRANSPORT_ERROR with no error message., response: {status: -90,
data: Obj,
httpResponseCode: 404,
transactionNum: 1,
clientContext: Obj,
context: Obj,
startRow: 0,
endRow: 0,
totalRows: 0}
Comment