Hi i am using GWT to send a file using a servlet.
Initially iwas trying to send only file to server. That was working fine.
Now in af ormPanel I added 3 Listbox.
private ListBox propertyNamelist = getListBox("propertyName");
private ListBox propertyTypeList = getListBox("propertyType");
private ListBox propertyValueList = getListBox("propertyValue");
private ListBox getListBox(String name){
listbox = new ListBox();
listbox.setName(name);
return listbox;
}
it is then added to FormPanel.
formPanel.setWidget(propertyNamelist);
formPanel.setWidget(propertyTypeList);
formPanel.setWidget(propertyValueList);
formPanel.submit();
On the Server side.
try {
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iterator = upload.getItemIterator(request);
while (iterator.hasNext()) {
FileItemStream item = iterator.next();
stream = item.openStream();
if (item.isFormField()) {
log.warning("Got a form field: " + item.getFieldName());
System.out.println(" chk fg " +item.getFieldName() +" = "+ Streams.asString(item.openStream()));
} else {
log.warning("Got an uploaded file: " + item.getFieldName()
+ ", name = " + item.getName());
fileName = item.getName();
mimetype = item.getContentType();
}
}
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Output :
WARNING: Got a form field: propertyValue
Jun 11, 2012 11:37:55 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /UploadFileServlet: org.apache.commons.fileupload.FileItemStream$ItemSkippedException
chk fg propertyValue = motivation
according to me motivation is a first value of listbox PropertyValue, where as there are more values in list box.
And there are more list box which should be displayed.
I am not able to understand y this is happening.
Note : I cant send Listbox through RPC cause these list box is related to file which is to send to server and server to external repository.
Some one plz Help.
As its name imply
setWidgetonFormPanelreplaces the content of theFormPanelwidget.You want to put several widgets inside your
FormPanel, so use an intermediary container (such as aFlowPanel) to put your widgets in: