开发者

GWT Fileupload Using Servlet with GUICE

We are using GWTP with Guice. I want to upload a file. For that I have written a Servlet.

I am using this GWT File UPload Example. But Servlet is not getting called. I think its the problem with GuiceFilter. Below is my web.xml entry.


Web.xml

<listener>
        <listener-class>com.nextenders.server.guice.GuiceServletConfig</listener-class>
    </listener>
<filter>
    <filter-name>guiceFilter</filter-name>
    <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>guiceFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>


<servlet>
    <servlet-name>FileUploadServlet</servlet-name>
    <servlet-class>com.nextenders.server.guice.actions.FileUploadServlet</servlet-class>   
</servlet>

<servlet-mapping>
    <servlet-name>FileUploadServlet</servlet-name开发者_StackOverflow中文版>
    <url-pattern>/upload/fileUpload</url-pattern>
</servlet-mapping>

Any pointers would be great help.


If you're using Guice, you mush use Guice ServletModule class to set up your servlets.

Ex: serve("/upload/pictures").with(PictureUploader.class);

Documentation: http://code.google.com/p/google-guice/wiki/ServletModule

Cheers,


I found out the problem and solved on my own. Here is the answer:

It was not the problem with the GUICE Servlet Filter.

The problem was with Coade statements placing. FileUpload com.google.gwt.user.client.ui.FileUpload should be used with FormPanel.

FileUpload must be used with FormPanel if it is to be submitted to a server.

I had used GWT file upload earlier but skipped thorough my mind.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜