页面中:
<s:action name="test"></s:action>
action:
public class Test extends ActionSupport{ @Override
public String execute() throws Exception {
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~");
return null;
}
}
struts.xml:
<action name="test" class="com.shop.action.Test">
</action>
我的疑问是我打开页面时怎么不调用action,迷惑!
<s:action name="test"></s:action>
action:
public class Test extends ActionSupport{ @Override
public String execute() throws Exception {
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~");
return null;
}
}
struts.xml:
<action name="test" class="com.shop.action.Test">
</action>
我的疑问是我打开页面时怎么不调用action,迷惑!
还有web.xml,struts.xml你试一下在action 里面加上:executeResult="true" 看有用没
<action name="test" class="com.shop.action.Test">
</action>你起码把调用action的那个方法 写出来吧
还有web.xml,struts.xml你试一下在action 里面加上:executeResult="true" 看有用没
xecuteResult="true" 没有用啊!
<s:action name="test" namespace="/">
你有设置result吗?
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~");
return null;
}你这个东西返回null,当然就啥都没有了,不是没调用,而是你没有指定他转向哪个页面
用return null是正常的做法吧
中加入 Test 中定义的对象实例,而且实现get**()和set**()方法,就可以了,struts2会自动帮你注入,这样打开页面的时候 就会自动调用action了。。
大哥,求解,怎么加入 Test 中定义的对象实例?