1、index.jsp

<body>
动态结果 一定不要忘了为动态结果的保存值设置set get方法
<ol>
<li><a href="user/user?type=1">返回success</li>
<li><a href="user/user?type=2">返回error</li>
</ol>
</body>

2.struts.xml

<struts>
<constant name="struts.devMode" value="true" />
<package name="user" namespace="/user" extends="struts-default">
<action name="user" class="com.wxh.action.UserAction">
<result >${r}</result>
</action>
</package>
</struts>

3.UserAction.java

package com.wxh.action;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
private int type;
private String r;
public String getR() {
return r;
}
public void setR(String r) {
this.r = r;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
//动态确定r的值
public String execute() throws Exception{
if(type==1) r="/userSuccess.jsp";
else if(type==2) r="/userError.jsp";
return "success";
}
}

4.userError.jsp

<body>
user error!
</body>

5.userSuccess.jsp

<body>
user Success!
</body>

最新文章

  1. PHP插入header(&#39;content-type:text/html;charset=&quot;utf-8&#39;)和error_reporting()
  2. SurfaceOutput
  3. back(返回)键总结
  4. 防范 DDoS 攻击的 15 个方法
  5. Svn忽略配置
  6. Delphi 调试Dll报错 通过GetLastError显示错误信息。
  7. hdu 2199
  8. Oracle EBS-SQL (SYS-4):sys_职责查询.sql
  9. 还是回文(dp)
  10. PHP-5.5.10+Apache httpd-2.4.9在Windows系统下配置实战
  11. table中td的宽度不随文字变宽
  12. 201521123067 《Java程序设计》第6周学习总结
  13. BZOJ 3512: DZY Loves Math IV [杜教筛]
  14. linux 值安装yum包
  15. Microsoft Bot Framework with LUIS
  16. JAVA 程序编译过程;编辑器,编译器和解释器
  17. left join 右表数据不唯一的情况解决方法
  18. pytorch backward问题
  19. Centos安装gcc及g++
  20. 每日英语:Marriage makes our children richer — Here&#39;s why

热门文章

  1. springMVC返回数据的四种方式
  2. Necklace of Beads(polya定理)
  3. 8.20noip模拟题
  4. JavaScript 进阶 常用内置对象
  5. 树莓派-基于raspivid实现拍视频
  6. 努比亚(nubia) M2青春版 NX573J 解锁BootLoader 并进入临时recovery ROOT
  7. wamp中的mysql服务与原来安装的mysql服务冲突的解决办法
  8. centos开机运行级别更改
  9. 重新理解 Monad
  10. python 遍历xml所有节点