浏览器地址栏:
http://localhost:8080/Struts2/test/l_execute2.do?name=dzr&id=121212
struts.xml配置页面
<action name="l_*" class="cn.dzr.action.HelloWorldAction" method="{1}">
<result name="success">/WEB-INF/page/hello.jsp</result>
</action>JSP页面:
<body> <h2>name=${name }</h2>
<h2>id=${id }</h2>
</body>
</html>
Action页面:
private int id;
private String name; public int getId()
{
return id;
} public void setId(int id)
{
this.id = id;
} public String getName()
{
return name;
} public void setName(String name)
{
this.name = name;
}
//...... public String execute2()
{
return "success";
}
结果运行的时候,页面显示了传递进来的参数。可是不清楚,究竟是在什么时候,参数被传递进了action。
http://localhost:8080/Struts2/test/l_execute2.do?name=dzr&id=121212
struts.xml配置页面
<action name="l_*" class="cn.dzr.action.HelloWorldAction" method="{1}">
<result name="success">/WEB-INF/page/hello.jsp</result>
</action>JSP页面:
<body> <h2>name=${name }</h2>
<h2>id=${id }</h2>
</body>
</html>
Action页面:
private int id;
private String name; public int getId()
{
return id;
} public void setId(int id)
{
this.id = id;
} public String getName()
{
return name;
} public void setName(String name)
{
this.name = name;
}
//...... public String execute2()
{
return "success";
}
结果运行的时候,页面显示了传递进来的参数。可是不清楚,究竟是在什么时候,参数被传递进了action。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货