struts2 后台action向前端JSP传递参数的问题
2024-08-29 14:00:50
后台有个方法,里面部分代码如下:
System.out.print("alter:"+user.getId());
User temp=userservice.getUserByUserId(user.getId());
System.out.print(temp.getUsername());
ActionContext.getContext().put("temp", temp);
return "userAlter";
经过调试,temp对象是有值的,上面的代码也是正确的,但是如果我将 ActionContext.getContext().put("temp", temp);换乘 ActionContext.getContext().put("user", temp);,那么前端就无法显示内容。
前端代码:
信息修改: ${temp.id} ${temp.username }用户名:${user.username } 用户密码:${user.password }
这里面的问题,我不知道是什么原因。我猜应该是Put的键和由spring托管的那个user变量同名,可能spring无法处理之类的。。暂且这么理解吧!
最新文章
- 逆天通用水印支持Winform,WPF,Web,WP,Win10。支持位置选择(9个位置 ==》[X])
- codeforces 597C C. Subsequences(dp+树状数组)
- 说说markdown和latex的简单比较
- Pyqt 打开外部链接的几种方法
- android-数据存储之远程服务器存储
- 需要使用id内省方法--responsesToSelector: 的两个地方
- Cmd命令
- Java String类详解
- c#中进程的使用
- sessionStorage、localStorage、cookie
- GNU Make 学习系列一:怎样写一个简单的Makefile
- 九思老客户分享:部署OA办公系统的四大意义
- numpy数组、向量、矩阵运算
- asp.net -mvc框架复习(1)-ASP.NET网站开发概述
- CF198 div1 D - Iahub and Xors
- iOS刚进入后台接受推送、打开推送调转到相应的界面
- svn版本提交冲突问题解决详解
- 01-初识MySQL数据库
- The Apache HBase™ Reference Guide
- 使用mybatis中的自定义TypeHandler处理PostgreSQL中的Json类型字段