2010-07-28 56 views
1

我在模塊的服務器文件夾中有以下一段代碼。正則表達式類不工作在服務器端的GWT

Pattern regex = Pattern.compile("/(B[A-Z0-9]{9})/"); 
Matcher matcher = regex.matcher(detailPageUrl); 

但我仍然得到以下錯誤:

[ERROR] Line 14: The import java.util.regex cannot be resolved 
[ERROR] Line 15: The import java.util.regex cannot be resolved 
[ERROR] Line 202: Pattern cannot be resolved to a type 
[ERROR] Line 202: Pattern cannot be resolved 
[ERROR] Line 203: Matcher cannot be resolved to a type 

我的代碼進口

import java.util.regex.Matcher; 
import java.util.regex.Pattern; 

我認爲Regex將在服務器端工作。爲什麼這不起作用?

+0

發佈您的文件夾結構。 「服務器」上的代碼究竟是什麼? – Strelok 2010-07-28 23:46:28

回答

1

首先檢查Java環境。像Java版本,類路徑等一樣。錯誤明確指出由於某種原因無法導入軟件包。

+0

是的,我已經包含GWT module.xml文件中的服務器文件夾。這導致GWT編譯器也編譯我的服務器端代碼。 – user855 2010-08-07 20:29:30