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. I added a regular expression (RE) client side to check an input text input. Well, it happens that the RE works fine in development mode but doesn't when deploying on tomcat. I also tried to deploy on tomcat in development mode and the RE works fine. I only have problems when deploy the related war file on tomcat.
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. Actually GWT uses com.google.gwt.regexp.shared.RegExp under the hood.
com.google.gwt.regexp.shared.RegExp does not support \A and \z, so I replaced those with ^ and $. That works fine for me now.
精彩评论