struts2中从jsp到action是如何传递参数的?

extjs的jsp中:var url = "esf_querybyhql.action";这里用action
配置文件中:
<action name="esf_*" class="esfAction" method="{1}">
<result name="index">WEB-INF/fygl/esf.jsp</result>
<interceptor-ref name="loginedCheck"/>
<interceptor-ref name="defaultStack"/>
</action>

在页面上使用问号或者表单可以直接向action传递参数,与一般网页并无二致。

<a href="a.action?id=1">这里使用get方式传入参数id值为1</a>
<br/>
下面使用post方式向b.action传递参数id值为1
<form method="post" action="b.action">
<input name="id" value=1>
<input type="submit" value="提交">
</form>

温馨提示:内容为网友见解,仅供参考
第1个回答  2013-08-26
按Form传递,直接在Action中定义属性,和JSP页面的Form中的名称相同,就可以传递了
第2个回答  推荐于2017-11-26
jsp中:<from action="insert.action">
<input type="text" name="username">
</from>

struts.xml中:包的那个就不写了
<action name="insert" class="com.insertAction" method="insert"><result>/index.jsp</result></action>

Action中:

public String insert(){
中间写你调用的东西

return "success";
}本回答被提问者采纳
相似回答