0
我想從Request變量中獲取參數後變爲「」而不是null。AspectJ getParameter()
import javax.servlet.ServletRequest;
public aspect GetParameter {
pointcut getParam(ServletRequest req, String s):
target(req) && args(s) &&
execution(String javax.servlet.ServletRequest.getParameter(String));
String around(ServletRequest req, String s): getParam(req, s) {
String result = req.getParameter(s);
if (result == null) {
return "";
}
return result;
}
在管線String around(ServletRequest req, String s): getParam(req, s) {
Eclipse中顯示此mesage:在aspects.GetParameterOrAttribute定義建議尚未應用於 [Xlint:adviceDidNotMatch]
它的工作原理,非常感謝! – sard