Struts2 动态结果集
动态 结果 struts2
2023-09-11 14:20:45 时间
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"; } }
<body> user error! </body>
5.userSuccess.jsp
<body> user Success! </body>
相关文章
- 动态可视化 数据可视化之魅D3,Processing,pandas数据分析,科学计算包Numpy,可视化包Matplotlib,Matlab语言可视化的工作,Matlab没有指针和引用是个大问题
- 【BZOJ1413】[ZJOI2009]取石子游戏(博弈论,动态规划)
- 【BZOJ4361】isn(动态规划,容斥)
- C#,动态规划的集合划分问题(DP Partition problem)算法与源代码
- oracle中动态SQL使用详细介绍
- cglib 动态代理基础篇
- swift里 as、as!、as?区别 T.Type与动态类型
- 动态生成web表-asp.net table
- easy ui datagrid 动态绑定数据并绑定链接,进行操作
- 动态规划法求解背包问题原理思路
- iView table动态设置filters
- 迅时2017年1季度产品动态
- 基于文字识别动态扫描,通过字符间距计算模糊匹配率,调用语音识别接口把返回结果进行语音播报,改换数据源可应用多场景进行识别、监测、报警、分析等,支持在线识别和离线识别两种方式