jsf - 如果对象的引用发生更改,Ajax 渲染将不起作用
问题描述
当对象用户使用新引用更改时,不会渲染 render="form01:name" 但是当我使用来自服务的数据将名称设置到现有对象时,它可以工作。你能告诉我为什么吗。
<h:inputText id="username" styleClass="form-control "
value="#{inscription.user.username}" />
</h:inputText>
<h:commandLink role="button" styleClass="btn btn-primary" id="" render="true" title="title">
<f:ajax listener="#{inscription.loadData(inscription.user)}" execute="username"
render="form01:name"/>
</h:commandLink>
User user = new User();
public void loadData(User user) {
// this.user is remplace with an User from the service, the render doesn't works
this.user = userService.getUser(user.getUsername)); ---> not working
//---------------------
// if I remplace the code above with this code, the render works
User u = userService.getUser(user.getUsername));
this.user.setName(u.getName()); ---> working
}
解决方案
推荐阅读
- python - 我如何一次请求所有这些 API?
- python - 在 CSV 中将 3 行合并为 1 行
- java - 在 Java 中生成时防止 CSV 文件注入
- flutter - 如何在 Flutter 中每 x 分钟展示一次有趣的广告,但作为后台任务?
- sql-server - 从存储 XML 且数据类型为 CLOB 的字段中检索数据
- c# - 玩家因鼠标倾斜而移动
- javascript - 如何在 FlatList renderItem 中使用 useAnimatedStyle?
- python-3.x - 如何覆盖 django 模型表单中的字段名称属性?
- javascript - “AudioContext 不允许启动。” 在 React 中使用 useSound 钩子时的警告
- .net - 如何更改所有组合框的属性?