gpt4 book ai didi

java - 提交 FormPanel 后的警报窗口

转载 作者:行者123 更新时间:2023-12-02 00:06:50 25 4
gpt4 key购买 nike

我有下一个问题...当我提交表单并且我的 Post 方法结束时。形成(或不形成)抛出空警报窗口。我怎样才能删除这个抛出窗口?

客户端

 ....            
final FormPanel form = new FormPanel();
form.setAction(GWT.getModuleBaseURL()+"upload");

form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setMethod(FormPanel.METHOD_POST);

VerticalPanel panel = new VerticalPanel();
form.setWidget(panel);

FileUpload upload = new FileUpload();
upload.setName("uploadFormElement");
panel.add(upload);

fileButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
form.submit();
}
});

FileUploadServlet

public class FileUploadServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
super.doGet(req, resp);
}

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {


if (ServletFileUpload.isMultipartContent(req)) {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);

try {
List<FileItem> items = upload.parseRequest(req);
for (FileItem fileItem : items) {
if (fileItem.isFormField()) continue;
String fileName = fileItem.getName();
if (fileName != null) {
fileName = FilenameUtils.getName(fileName);
}
File uploadedFile = new File("test.txt");
if (uploadedFile.createNewFile()) {
fileItem.write(uploadedFile);
}

}
} catch (FileUploadException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}

也许有人知道此警报的原因?

最佳答案

如果它是一个简单的 Javascript 警报窗口,您需要在三个地方跟踪/搜索它

步骤 - 在客户端代码中搜索警报字符串

1) In javascript - third party .js file . String search for `alert` in such js files

2) In third party gwt jar .
a) String search for Window.alert in the GWT java code
b) String search for wnd.alert in GWT jsni code

3) In Your own source code - repeat steps "a" and "b" from Step 2

这不太可能,但如果他们正在构建一个字符串作为响应并通过某种其他机制显示它,那么字符串也会搜索您的服务器端代码库。

关于java - 提交 FormPanel 后的警报窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13673292/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com