Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6388803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:19:29+00:00 2026-05-25T03:19:29+00:00

I have a simple GWT application that consists of a FormPanel that contains a

  • 0

I have a simple GWT application that consists of a FormPanel that contains a single FileUpload field. The action on this form is to send it to GWT.getModuleBaseURL() + “process”, which web.xml in turn tells GWT is the FileProcessServlet.

FileProcessServlet is a class that I made that extends HttpServlet and overrides doPost(HttpServletRequest req, HttpServletResponse resp) to parse the uploaded file and turn it into a Base64 string using Base64Utils. Now, I would like to pass the client side a single string that is the Base64 encoding of the file just sent it.

For the life of me, I just cannot figure out how to do this. The GWT documentation on Communicating with the Server doesn’t say anything about receiving information back from a FormPanel.submit(). There is no callback function associated with such a request, as is the case with GWT RPC. At the same time, I need to use a servlet, since I want to parse a file, and that can’t be done by the client. Any suggestions?

~~~~

PS: One option is that I can write directly to the html page from the servlet using java.io’s PrintWriter (as this suggests). This may present a kind of solution where I store the Base64 string in a div with a special ID and then use DOM to get this content on the client end. However, I have not yet gotten PrintWriter to cooperate with me. Anytime I use it, with varying content types and character encodings, I still see nothing printed on the page. What I currently have attempting to print this out is:

        String base64 = Base64Utils.toBase64(file);
        resp.setContentType("text/html; charset=UTF-8");
        resp.setCharacterEncoding("UTF-8");
        PrintWriter out = resp.getWriter();
        out.print(base64);
        out.flush(); out.close();

But nothing comes out. The debugger has confirmed that the string base64 is not null nor empty on the penultimate line. Any help on this related front would also be appreciated. Nonetheless, I sincerely hope there is a better way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:19:30+00:00Added an answer on May 25, 2026 at 3:19 am
    form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
          public void onSubmitComplete(SubmitCompleteEvent event) {
            // When the form submission is successfully completed, this event is
            // fired. Assuming the service returned a response of type text/html,
            // we can get the result text here (see the FormPanel documentation for
            // further explanation).
            Window.alert(event.getResults());
          }
        });
    

    Whatever you write out from the servlet, will be in the event.getResults(), in your case the base64 String

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple java applet that is invoked from gwt application. Is there
I have developed a simple application in GWT. After that, I generate war file
I have simple php validation form that is halfway working. If you leave the
I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input
I have implemented a simple GWT application featuring a login service (LoginService) and a
I have developed a simple GWT application with the client/server packages. From server package
I have a view that I created in my GWT application and I would
I have been trying to create a simple application that will let the user
I have a GWT MVP application using Activities and Places. This is inspired by
I have implemented pretty simple application, using gwt and gwt event service 1.1.1, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.