struts2 redirect 配置动态传递参数
2015-06-16 15:59
465 查看
<action name="actionName" class="com.towerking.TestAction" method="executeMethod"> <result name="success" type="redirect">login.jsp?flag=success&userType=${userType}</result> <result name="error" type="redirect">login.jsp?flag=error&userType=${userType}</result> </action>
在配置Struts2的时候,有时需要配置多个参数,且其中一个参数是根据实际情况动态变化的,则需要通过上述方法进行配置。
其中在XML文件中,配置 & 需要使用
&
否则Struts2会出现如下错误:struts2 the reference to entity must end with the ' ;' delimiter。
在配置代码中userType的引用值,需要在对应的action中赋值,否则无法获取到。
相关文章推荐
- 使用Java实现简单的server/client回显功能的方法介绍
- solr源码导入eclipse
- struts 2读书笔记-----struts2的开发流程
- java打包时,导入第三方jar运行出现ClassNotFoundException
- [Training Video - 6] [File Reading] [Java] Read Properties file
- java中的URLEncoder.encode对应JS中用decodeURIComponent,js和java编码,解码
- Java中Volatile关键字详解
- 接口测试-自动化-Java实现-HtmlFile
- Spring读书笔记-----Spring的Bean之设置Bean值
- Java Tips
- 【原创】中文分词系统 ICTCLAS2015 的JAVA封装和多线程执行(附代码)
- JAVA调用系统命令或可执行程序--返回一个Runtime运行时对象,然后启动另外一个进程来执行命令
- java 正则表达式去除标点符号
- (转) Spring读书笔记-----Spring的Bean之配置依赖
- java二叉树的遍历算法
- Windows下Eclipse中免Cygwin的JNI配置及Demo调试
- java形式参数和实际参数
- java多线程二
- Java设计模式--工厂模式
- 使用replaceAll()替换有"+"的字符串出现:java.util.regex.PatternSyntaxException