>关于struts2的action的问题如下:
>
>jsp页面:
> ——————————————————————
> <s:action namespace="/" name="action1" executeResult="true" ignoreContextParams="false" >
<s:param name="str">my test str"1" !</s:param>
</s:action>
>——————————————————————
>
>struts.xml页面:
>——————————————————————————
> <action name="action1" class="com.action.MyAction" method="action">
> <result name="success">/1102/action.jsp</result>
> <param name="str">care out !!!!</param>
> </action>
>————————————————————————
>action页面:
>——————————————————
>public String action() throws Exception {
> str = "你的IP是:"+ServletActionContext.getRequest().getRemoteAddr()+",请求参数 str = "+str;
> return super.execute();
> }
>——————————————————————————————
>
>jsp页面:
> ——————————————————————
> <s:action namespace="/" name="action1" executeResult="true" ignoreContextParams="false" >
<s:param name="str">my test str"1" !</s:param>
</s:action>
>——————————————————————
>
>struts.xml页面:
>——————————————————————————
> <action name="action1" class="com.action.MyAction" method="action">
> <result name="success">/1102/action.jsp</result>
> <param name="str">care out !!!!</param>
> </action>
>————————————————————————
>action页面:
>——————————————————
>public String action() throws Exception {
> str = "你的IP是:"+ServletActionContext.getRequest().getRemoteAddr()+",请求参数 str = "+str;
> return super.execute();
> }
>——————————————————————————————
本文深入探讨了Struts2框架中Action配置、执行过程及参数传递机制,通过具体实例展示如何在jsp页面中调用Action,并解析struts.xml文件中Action的详细配置。
889

被折叠的 条评论
为什么被折叠?



