Hi juan

thanks for reply;

But According to me fileUpload is inside FormPanel
 formPanel.setWidget(getFlexTable_1());

flexTable.setWidget(1, 1, getFileUpload());





On Wed, Aug 22, 2012 at 7:26 PM, Juan Pablo Gardella <
gardellajuanpa...@gmail.com> wrote:

> Try add the fileUpload component to the form.
>
> 2012/8/22 learning coding <learning.codin...@gmail.com>
>
>>  i want to send a file from client to server.
>>
>> My code: Client side:
>>
>> 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.setWidget(getFlexTable_1());
>>
>>                 System.out.println(GWT.getHostPageBaseURL() 
>> +"UploadFileServlet");
>>     }
>>     return formPanel;
>> }
>>
>> In getFlexTable_1()
>>
>> flexTable.setWidget(1, 1, getFileUpload());
>>
>> in getFileUpload()
>>
>> private FileUpload getFileUpload() {
>>     if (fileUpload == null) {
>>         fileUpload = new FileUpload();
>>         fileUpload.setName("upload");
>>     }
>>     return fileUpload;
>> }
>>
>> private Button getAddButton() {
>>         if (addButton == null) {
>>             addButton = new Button("ADD");
>>             addButton.addClickHandler(new ClickHandler() {
>>                 public void onClick(ClickEvent event) {
>>                                formPanel.submit();
>>         }
>>         });
>>     }
>> return addButton;
>>
>> }
>>
>> On server side
>>
>> public class CmisFileUpload extends HttpServlet implements Servlet{
>>
>>     protected void doGet(HttpServletRequest request,
>>             HttpServletResponse response) throws ServletException, 
>> IOException {
>>         doPost(request, response);
>>     }
>>
>>     protected void doPost(HttpServletRequest request,
>>             HttpServletResponse response) throws ServletException, 
>> IOException {
>>
>>         byte[] buffer = new byte[115200];//
>>         String fileName = null;
>>         String mimetype = null;
>>         String majorVersion = null;
>>         InputStream stream = null;
>>         System.out.println("ServletWorking Fine");
>> }
>>
>> *Now when i Choose a file and click on ADD button i cant see the output
>> on server side for this code System.out.println("ServletWorking Fine");*
>>
>> The outPut of System.out.println(GWT.getHostPageBaseURL()
>> +"UploadFileServlet"); on client side is
>>
>> *http://127.0.0.1:8888/UploadFileServlet*
>> and when i use this url directly on browser i get server side output for 
>> System.out.println("ServletWorking
>> Fine");**
>>
>> Plz tell me why formpanel.submit is not working.
>>
>> Regards
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to google-web-toolkit@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-web-toolkit+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to