通过调用 Ajax 来设置 struts bean 值
Setting struts bean value by calling Ajax
我的情况是我需要调用一个类方法并执行一些任务,这将返回一些数据,并且需要将相同的数据设置为Struts bean并在jsp页面中动态显示相同的数据
<tr>
<td><s:select id="selectProductCode" list="#session['UDM_Product_Codes']" name="selectProductCode" onchange="callXmethod(this);" /></td>
<td><s:textfield theme="simple" name="assignedProductBean.assignedProductKey" value="" /></td>
<td><s:select label="selectRole" id="selectRole" name="roleList" list="assignedProductBean.roleList" /></td>
<td><b><s:a href="javascript:createRole()">CREATE</s:a></b></td>
<td></td>
<td></td>
</tr>
一旦我选择了 Product,我就需要在我的操作类中调用一些方法,该方法将一些数据再次设置为 bean,具体取决于两个字段的其余部分所依赖的
我仍然不确定您面临什么问题。你所描述的很有可能,你需要照顾Ajax(Jquery)的一切。您可以创建一个 Ajax 方法,该方法可以将值传递给您的 Action 类并可以返回结果。
我建议你看看Struts2-Jquery插件,因为基于JSON的通信更加灵活,jQuery以一种很好的方式补充了JSON,并提供了许多开箱即用的功能。
下面是一个示例,以了解所有这些如何协同工作
- 带有Struts2,JQuery和JSON插件的Ajax动态内容
相关文章:
- 从JavaScript访问struts操作中的属性
- 用Java/Struts/Spring项目实现Visual Captcha
- 我该如何从JSF Bean调用JavaScript函数
- Struts 2中的澄清
- 访问托管Bean中的ApplicationModule(FacesContext NULL)
- 使用jstl c:forEach在迭代jsp bean上创建javascript json对象
- 将数组从 Spring bean 转换为 JSON 以在 JSP 中引用
- 使用 struts 标签和 Javascript 的动态行为保留表单中的值
- 将变量从 bean 传递到素数页
- 使用 Bean 对象中的 JSON 构造数组
- 通过调用 Ajax 来设置 struts bean 值
- 如何使用 Struts 1.3 和 javascript 创建表的动态行
- 从 javascript 调用 bean 方法
- JSP/Struts2:如何访问所选表行中的对象bean
- 我需要从jsp页面向struts操作类进行ajax调用,以获得一些数据,如名称搜索
- 如何使用javascript/jquery获取html struts styleClass
- 带有struts的Jsp上出现Javascript错误
- 如何使用按钮的jsp点击事件将属性设置为struts-bean
- Dropdown基于jsp Struts中的另一个下拉列表
- 在 struts 2 中将 java bean 转换为 json 数据