[英]GWT: development mode behaves different from server mode
this is a 10 million dollar question! 这是一千万美元的问题! I am developing with GWT 2.1.1, MVP framework, GIN and deploying on tomcat 6. Never had any problem so far. 我正在使用GWT 2.1.1,MVP框架,GIN进行开发并在tomcat 6上进行部署。到目前为止,还没有任何问题。 I added a regular expression (RE) client side to check an input text input. 我添加了一个正则表达式(RE)客户端来检查输入文本输入。 Well, it happens that the RE works fine in development mode but doesn't when deploying on tomcat. 好吧,碰巧RE在开发模式下可以正常工作,但是在tomcat上部署时却不能。 I also tried to deploy on tomcat in development mode and the RE works fine. 我还尝试以开发模式在tomcat上进行部署,并且RE可以正常工作。 I only have problems when deploy the related war file on tomcat. 只有在tomcat上部署相关的war文件时,我才有问题。
Here's the code: 这是代码:
private static String VALID_INPUT_STRING = "((\\A[1-9]{1}[0-9]{0,4}\\z)|(\\A[1-9][0-9]{0,2}\\.[0-9]\\z)|(\\A0\\.[1-9]\\z))";
public boolean isValidInput(String input) {
if(
input.isEmpty() || input.matches(VALID_INPUT_STRING)
) {
return true;
}
return false;
}
if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER
&& isValidInput(inputValue.getText())) {
hideInsertPopUp();
}
Any idea?? 任何想法?? Thank you very much. 非常感谢你。
I got it. 我知道了。 I used String.matches client side. 我使用String.matches客户端。 Actually GWT uses com.google.gwt.regexp.shared.RegExp under the hood. 实际上,GWT在后台使用com.google.gwt.regexp.shared.RegExp。
com.google.gwt.regexp.shared.RegExp does not support \\A and \\z , so I replaced those with ^ and $ . com.google.gwt.regexp.shared.RegExp不支持\\ A和\\ z ,因此我将它们替换为^和$ 。 That works fine for me now. 现在对我来说很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.