8
I have to send file and their properties to GWT server.
For sending a file i used form panel.
public class BrowseFile extends DialogBox {
// more code
// ..
private FormPanel getFormPanel() {
if (formPanel == null) {
formPanel = new FormPanel();
formPanel.setMethod(FormPanel.METHOD_POST);
formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
formPanel.setAction(GWT.getHostPageBaseURL() +"UploadFileServlet");
formPanel.addSubmitHandler(new FormPanel.SubmitHandler(){
public void onSubmit(SubmitEvent event) {
// TODO Auto-generated method stub
setFilename(fileUpload.getFilename());
}
});
}
return formPanel;
}
}
all the properties of this file are in Hashmap

there are 2 dialog box Propertybox extends DialogBox and
BrowseFile extends DialogBox
inside the constructor of PropertyBox there is BrowseFile
When PropertyBox constructor
setSize("600px", "670px");
setHTML("Add Document");
setWidget(getVerticalPanel());
browseFile = new BrowseFile();
The custom Property inside the PropertyBox depends on the class selected (Class is tree Widget)
On Server Side
public class FileUpload extends HttpServlet implements Servlet{
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(FileUpload.class
.getName());
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,