jsp页面加载过程中执行struts 2的action

想要在jsp页面加载过程中调用struts 2的action方法

1.需要在jsp页面中添加标签<%@ taglib uri="/struts-tags" prefix="s" %>

   

2.然后在jsp页面中的<body>中的第一行写上<s:action name="getProvince" namespace="/Message" executeResult="true"></s:action> ,其中name是调用struts中的action方法的名称,namespace是命名空间,executeResult是指是否把返回结果显示到本页面中,有false和true两种选择。

     

猜你喜欢

转载自blog.csdn.net/wangyang163wy/article/details/48376819