莘县生活网

 找回密码
 立即注册
查看: 367|回复: 0

ajax实现异步无限级联

[复制链接]

8211

主题

8211

帖子

2万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
25419
发表于 2015-9-15 19:43:27 | 显示全部楼层 |阅读模式
  </action>

</package>





<result type="json" />

<action name="*" class="ajaxEvaluationAction" method="{1}">

<package name="Ajax" namespace="/ajax/evaluation" extends="json-default">

<!--******************** Ajax ******************** -->

*_struts.xml实现配置:

-----------------------------------------------

this.name = name;

public void setName(String name) {

return name;

public String getName() {

this.id = id;

public void setId(Long id) {

return id;

public Long getId() {

private String name;

private Long id;

public class EvaluationJSONVO {

供json使用的VO:www.111scweb.com

-----------------------------------------------------------------------------------------

return SUCCESS;

itemClassList.add(evaluationJSONVO);

evaluationJSONVO.setName(itemClass.getNameCN());

evaluationJSONVO.setId(itemClass.getId());

EvaluationJSONVO evaluationJSONVO = new EvaluationJSONVO();

ItemClass itemClass = itemClasses.next();

while (itemClasses.hasNext()) {

Iterator<ItemClahttp ss> itemClasses = systemClass.getItemClasses().iterator();

SystemClass systemClass = (SystemClass) systemClassManager.findById(systemClassId);

if (systemClassId.intValue() != 0) {

itemClassList.clear();

public String allItemClass() throws Exception {

return SUCCESS;

systemClassList.add(evaluationJSONVO);

evaluationJSO222scNVO.setName(systemClass.getName());

evaluationJSONVO.setId(systemClass.getId());

EvaluationJSONVO evaluationJSONVO = new EvaluationJSONVO();

SystemClass syswww.222sc.somtemClass = systemClasses.next();

while (systemClasses.hasNext()) {

Iterator<SystemClass> systemClasses = medicalCenter.getSystemClasses().iterator();

MedicalCenter medicalCenter = (MedicalCenter) medicalCenterManager.findById(medicalCenterId);

if (ue() != 0) {

systemClassList.clear();

public String allSystemClass() throws Exception {

this.itemClassList = itemClassList;

public void setItemClassList(List<EvaluationJSONVO> itemClassList) {

return itemClassList;

public List<EvaluationJSONVO> getItemClassList() {

this.systemClassList = systemClassList;

public void setSystemClassList(List<EvaluationJSONVO> systemClassList) {

return systemClassList;

public List<EvaluationJSONVO> getSystemClassList() {

this.systemClassId = systemClassId;

public void setSystemClassId(Long systemClassId) {

return systemClassId;

public Long getSystemClassId() {

this.medicalCenterId = medicalCenterId;

public void setMedicalCenterId(Long medicalCenterId) {

return medicalCenterId;

public Long getMedicalCenterId() {

private List<EvaluationJSONVO> itemClassList = new ArrayList<EvaluationJSONVO>();

private List<EvaluationJSONVO> systemClassList = new ArrayList<EvaluationJSONVO>();

private Long systemClassId;

private Long medicalCenterId;

private MedicalCenterManager medicalCenterManager;

@Autowired

private SystemClassManager systemClassManager;

@Autowired

public class AjaxEvaluationAction extends BaseAction {

@Controller("ajaxEvaluationAction")

@Scope("prototype")

@SuppressWarnings("serial")

ajaxAction事实上中的代码:

---------------------------------------------------------------------------------------------

</td>

<s:select list="classTypeList" name="classTypeId" listKey="id" listValue="code" headerKey="0"headerValue="comajax-请选择健康级别-" />

<td>

</td>

<s:select list="#{5:'男女都适用',0:'男',1:'女'}" name="entity.gender" listKey="key"listValue="value" />

<td>

</td>

</select>

<option selected="selected">--请选择项目--</option>

<select id="itemClassSelect" name="itemClassId">

<td>

</td>

</select>

<option selected="selected">--comajax实现异步无限级联请选择体系--</option>

<select id="systemClassSelect" name="systemClassId" onchange="scSelect();">

<td>

</td>

<s:select id="medicalCenterSelect" list="medicalCenterList" name="medicalCenterId"headerKey="0" headerValue="--看着www.222sc.som请选择体检中心--" listKey="id" listValue="name"onchange="mcSelect();" />

<td>

JSP部分代码:

----------------------------------------------------------------------------------------------

</script>

$("#itemClassSelect").html(itemClassOptions);

itemClassOptions += "<option value=""+n[j].id+"">"+n[j].name+"</option>";

for(var j=0; j<n.length; j++){

var itemClassOptions = "<option value="0">--对比一下www.11 请选择项目--</option>";

if("itemClassList" == i) {

$.each(data, function(i, n) {

success:function(data) {

dataType:"json",

async:false,

alert('服务器错误');

error:function(e) {

timeout,

data:'systemClassId='+systemClassSelectValue,

url:"../ajax/evaluation/allItemClass.xhtml",

type:"post",

$.ajax( {

$("#itemClassSelect").html("<option value="0">--222sc请选择项目--</option>");

var systemClassSelectValue = $("#systemClassSelect").val();

function scSelect(){

$("#systemClassSelect").html(systemClassOptions);

systemClassOptions += "<option value=""+n[j].id+"">"+n[j].name+"</option>";

for(var j=0; j<n.length; j++){

var systemClassOptions = "<option value="0">--你看http 请选择体系--</option>";

if("systemClassList" == i) {

$.each(data, function(i, n) {

success:function(data) {

dataType:"json",

async:false,

alert('comajax实现异步无限级联服务器错误');

error:function() {

timeout,

data:'medicalCenterId='+medicalCenterSelectValue,

url:"../ajax/evaluation/allSystemClass.xhtml",

type:"post",

$.ajax({

$("#itemClassSelect").html("<option value="0">--请选择项目--</option>");

$("#systemClassSelect").html("<option value="0">--你看请选择体系--</option>");

var medicalCenterSelectValue= $("#medicalCenterSelect").val();

function mcSelect(){

<script type="text/javascript">



听说ajax我不知道www.11
http
我不知道
级联

www.11
sc
学习异步
无限
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|申博娱乐 ( 晋icp备11001293号

GMT+8, 2018-6-21 18:24 , Processed in 0.272339 second(s), 21 queries .

Powered by 申博www.88msc.com

© 2006-2014 www.063508.com

快速回复 返回顶部 返回列表