小编New*_*ner的帖子

在GWT中将文件和HashMap发送到服务器

我必须将文件及其属性发送到GWT服务器.

用于发送文件我使用表单面板.

 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;
            }
        }   
Run Code Online (Sandbox Code Playgroud)

该文件的所有属性都在Hashmap中 GUi添加文档

有2个对话框Propertybox extends DialogBox

BrowseFile extends DialogBox
Run Code Online (Sandbox Code Playgroud)

在PropertyBox的构造函数中有BrowseFile

当PropertyBox构造函数

                setSize("600px", "670px");
    setHTML("Add Document");

    setWidget(getVerticalPanel());
    browseFile = new BrowseFile();
Run Code Online (Sandbox Code Playgroud)

PropertyBox内的自定义属性取决于所选的类(Class是树Widget)

在服务器端

public class FileUpload extends HttpServlet implements Servlet{

    private …
Run Code Online (Sandbox Code Playgroud)

java gwt servlets gwt-rpc gwt2

8
推荐指数
1
解决办法
1351
查看次数

无法在Windows 7,64位中正确设置java的路径

我在我的计算机上安装了java 1.6,并且还使用高级变量设置设置了路径.

在我尝试执行java时的命令提示符下出现此错误:

 Error: could not open `C:\Program Files\Java\jre7\lib\amd64\jvm.cfg'
Run Code Online (Sandbox Code Playgroud)

但是当我从命令提示符执行此命令时:javac -version显示我已经设置了正确的版本.

 javac 1.6.0_27.
Run Code Online (Sandbox Code Playgroud)

有人请帮我解决这个错误.

java windows cmd jdk1.6

6
推荐指数
1
解决办法
1万
查看次数

IncompatibleRemoteServiceException:此应用程序已过期,请单击浏览器上的刷新按钮

我的GWT项目工作正常,但今天,经过一些更改并添加新的一个异步调用没有执行.例外情况是"此应用程序已过期,请单击浏览器上的刷新按钮".执行所有其他异步调用.

 An IncompatibleRemoteServiceException was thrown while processing this call.
 com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This application is out of date, please click the refresh button on your browser. ( Blocked attempt to access interface 'com.client.FInterface', which is not implemented by 'com.server.FServiceImpl'; this is either misconfiguration or a hack attempt )
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:252)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
Run Code Online (Sandbox Code Playgroud)

客户:

     public void onClick(ClickEvent event) {

                            fService.getRepositories(repocallback);

        }
    });
Run Code Online (Sandbox Code Playgroud)

接口

   @RemoteServiceRelativePath("init")
  public interface FInterface extends RemoteService{    

    FCollection getRepositories();
 }
Run Code Online (Sandbox Code Playgroud)

AsyncInterface

  public interface FInterfaceAsync {
void getRepositories(AsyncCallback<FCollection> repositoryCallback);
} …
Run Code Online (Sandbox Code Playgroud)

java gwt gwt-rpc gwt2

5
推荐指数
1
解决办法
9620
查看次数

如何将hashMap转换为Json文件

我喜欢Java.

我必须使用rpc将Hashmap传输到服务器.

HashMap中

Map<String, String> testMap = new HashMap<String, String>();
testMap .put("1", "abc");
testMap .put("2", "ezc");
testMap .put("3", "afc");
testMap .put("4", "cvc");
..
Run Code Online (Sandbox Code Playgroud)

怎么做.

java gwt

5
推荐指数
2
解决办法
2万
查看次数

在 GWT 中读取客户端的文件

我想读取文件的内容并将其存储在数组中。我有一个使用 formPanel 和 formupload 浏览文件的代码。

如何读取文件并存储在数组中。

任何示例代码都会有很大帮助。

java gwt client-side gwt-rpc gwt2

2
推荐指数
1
解决办法
6417
查看次数

无法从对象复制到String数组中

我在从对象变量复制数组中的数据时遇到问题,对象变量也是String类型.

任何人都可以解释这个

 String[] childRoot = null;
 int k = 1;
 System.out.println(" Name " + d.getName()); 
 childRoot[k]=d.getName();                         *
 k++;
Run Code Online (Sandbox Code Playgroud)

产量

Name try 1
java.lang.NullPointerException
at *  
Run Code Online (Sandbox Code Playgroud)

详细信息:getName

  java.lang.String getName()
  Returns the name of this object 
Run Code Online (Sandbox Code Playgroud)

java

1
推荐指数
1
解决办法
92
查看次数

formpanel.submit不在GWT服务器上提交文件

我想从客户端发送文件到服务器.

我的代码:

客户方:

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;
}
Run Code Online (Sandbox Code Playgroud)

getFlexTable_1()

flexTable.setWidget(1, 1, getFileUpload());
Run Code Online (Sandbox Code Playgroud)

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; …
Run Code Online (Sandbox Code Playgroud)

gwt formpanel gwt2

1
推荐指数
1
解决办法
3020
查看次数

标签 统计

java ×6

gwt ×5

gwt2 ×4

gwt-rpc ×3

client-side ×1

cmd ×1

formpanel ×1

jdk1.6 ×1

servlets ×1

windows ×1