du3*_*369 3 java eclipse struts2
使用 Eclipse 进行调试时,有没有办法检查特定表达式的值?表达式视图并不总是那么有用。
例如:
public class P
{
public boolean executed = false;
public String getSomeString() {
if (!executed) {
executed = true; //set executed to true,so calling this method again will not yield the same result
return "someStr";
}else {
throw new RuntimeException();
}
}
}
Run Code Online (Sandbox Code Playgroud)
下面是主要方法:
public class Test {
public static void main(String[] args) {
P p = new P();
p.getSomeString(); //breakpoint here, I want to check the value of this expression, but it is not assign to a variable.
System.out.println();
}
}
Run Code Online (Sandbox Code Playgroud)
我在调试 Struts2 的时候就想到了这个问题。
在 的主体中Dispatcher#serviceAction(),有一行proxy.execute();是来自 的字符串值DefaultActionInvocation#invoke(),基本上是从操作返回的字符串。但是 的值proxy.execute();未分配给变量或在 内部的任何地方使用Dispatcher#serviceAction()。那么如何从与视图关联的操作中返回 String 呢?
| 归档时间: |
|
| 查看次数: |
3877 次 |
| 最近记录: |