Hello!
SmartGWT EE 3.0, Chrome 21.0 and IE 9.
I am trying to test the upload of a file to a database, but I am stuck in a NullPointerException, when trying to get the datasource from a ds.xml file.
fileUpload.ds.xml
GWTTests.html
GWTTests.java
The datasource is parsed successfuly, as can be seen in console.txt. But it's returning nullPointerException when trying to set to the form (dev-console.txt).
SmartGWT EE 3.0, Chrome 21.0 and IE 9.
I am trying to test the upload of a file to a database, but I am stuck in a NullPointerException, when trying to get the datasource from a ds.xml file.
fileUpload.ds.xml
Code:
<DataSource ID="fileUpload" serverType="sql" tableName="GWTTESTS"> <fields> <field name="FILE_VERSION" type="text"/> <field name="FILE_BLOB" type="binary"/> </fields> </DataSource>
Code:
<!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title></title> <script> var isomorphicDir = "gwttests/sc/"; </script> <script type="text/javascript" language="javascript" src="gwttests/gwttests.nocache.js"></script> </head> <body> <script SRC="sc/DataSourceLoader?dataSource=fileUpload"</script> </body> </html>
Code:
package local.tests.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DSResponse; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.ButtonItem; import com.smartgwt.client.widgets.form.fields.FileItem; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.layout.HLayout; /** * Entry point classes define <code>onModuleLoad()</code>. */ public class GWTTests implements EntryPoint { /** * This is the entry point method. */ public void onModuleLoad() { DataSource dataSource = DataSource.get("fileUpload"); final DynamicForm uploadForm = new DynamicForm(); uploadForm.setDataSource(dataSource); uploadForm.setWidth(300); TextItem versionItem = new TextItem("FILE_VERSION"); FileItem fileItem = new FileItem("FILE_BLOB"); ButtonItem saveItem = new ButtonItem("save", "SAVE"); saveItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { uploadForm.saveData(new com.smartgwt.client.data.DSCallback() { public void execute(DSResponse response, Object data, DSRequest request) { uploadForm.editNewRecord(); } }); } }); uploadForm.setFields(versionItem, fileItem, saveItem); HLayout topLayout = new HLayout(); topLayout.setMembers(uploadForm); topLayout.draw(); } }
Comment