


To do linkage effects, if you use pure JavaScript, you often need an auxiliary page to save the result set that needs to be refreshed, and then render it to the original page. Consider automatically splicing the content that needs to be dynamically refreshed after the previous drop-down box. After the current drop-down box onchanges, all subsequent drop-down boxes at the same level are cleared, and then the refreshed content is re-spliced. It is easier to implement with JQuery. The code is implemented using the province and city linkage effect as an example.
The JSP page code is as follows:
< ;li id="base">
Place of origin:
The JavaScript code is as follows:
function refreshCity(){
if($('#provinceCode').find('option:selected').val() == ""){
$('#provinceCode').parent().nextAll('lable').remove();
return;
}
//Province name
var provinceName = $('#provinceCode ').find('option:selected').text();
provinceName = provinceName.substring(0,provinceName.length-4);
//Issue a Json request to query the sub-drop-down box option data
$.getJSON("baseInfo_getCitiesByProvinceId", {
proviceCode : $('#provinceCode').val()
}, function(data) {
// If there are child options, create a child drop-down box
if(data != null){
// Delete all siblings after the drop-down box parent
$(' #provinceCode').parent().nextAll('lable').remove();
var childId = "city";
// Determine whether the next level drop-down box exists and create it if it does not exist
if($('#' childId).length == 0){
// Create a
}else{
//Empty the content of the child drop-down box
$('#' childId).empty();
}
// Traverse the json string and fill the child drop-down box
$ .each(data.city, function(i, item) {
$('#' childId).append(
"");
});
}
});
}
Get the city code according to the province as follows:
public void getCitiesByProvinceCode(String proviceCode, HttpServletResponse response) throws JsonParseException, JsonMappingException , JSONEXCEPTION, IOEXception {
PROVINCEINFO PROVINCEINFO = This.ProvincityInfoservice.getProvincobaby ("Code", ProvicCode; list & lt; cityInfo & gt; cityList = this.ProvincityInfoservice.getCityListByproperty ("BelongprovindId", "BelongProvinceid", "" );
// Initialize the Json string to be output
String cityJson = "";
// Traverse the collection and construct the json string
if (cityList.size() > 0) {
cityJson = "{"city":[";
// Splice the queried sub-items
for (int i = 0; i CityInfo city = cityList.get(i);
String temp = "{"code":"" city.getCode()
"","nameAndCode":"" city.getName() "(" city.getCode () ")"
""}";
// If it is the last item in the collection, splice the terminator, otherwise use "," to separate it
if (i == cityList.size( ) - 1) {
cityJson = cityJson temp "]}";
} else {
cityJson = cityJson temp ",";
}
}
}
/ / Set the output character set and type and output the json string
response.setCharacterEncoding("UTF-8");
response.setContentType("json");
response.getWriter().print(cityJson );
}

穿越苍茫征途,踏足西游之境!今日,征途IP正式宣布将与央视动画《西游记》展开跨界合作,共同打造一场融合了传统与创新的文化盛宴!此次携手,不仅标志着两大国产经典品牌的深度合作,更彰显了征途系列在弘扬中国传统文化道路上的不懈努力与坚持。征途系列自诞生以来,便凭借其深厚的文化底蕴和多元化的游戏玩法,受到玩家们的喜爱。在文化传承方面,征途系列更是始终保持着对中国传统文化的敬意与热爱,将传统文化元素巧妙地融入游戏,为玩家们带来了更多的乐趣和启发。而央视动画《西游记》则是陪伴了一代又一代人成长的经典之作,其

网易《阴阳师》手游在今日宣布,阴阳师×初音未来限定联动将于3月6日正式开始。联动限定SSR初音未来(CV:藤田咲)、SSR镜音铃·连(CV:下田麻美)即将降临平安京!联动线上特别演出活动3月9日在游戏内正式开启~

经典重聚,逆转时空。《天龙2》手游与经典电影《大话西游》携手定档4月11日!恰逢《天龙2》手游周年庆典,邀请大家共同重温经典回忆,再次见证至尊宝与紫霞至死不渝的传奇故事。七彩祥云要有,金甲圣衣也要有当那句“般若波罗蜜”回荡在耳边时,你是否会想起紫霞留在至尊宝心底的那一滴眼泪?一眼万年,却难逃宿命之劫。纵使万劫不复,吾爱至死不渝。大话西游联动外观【一眼万年】【天意】将随周年庆版本同步上线。愿你可以身披金甲圣衣又或可以邂逅自己的盖世英雄,重回至情至性的青春年少。五百年守护,真爱至死不渝那日偶遇洛阳说

日期,《逆水寒》官宣将于4月19号-5月12号与肯德基展开联动,但联动的具体内容却让很多人蚌埠住了,连番直说“尬上天了”、“要社死了”!原因就出在这次主题活动的口号上,曾经见识过《原神》《崩铁》肯德基联动的小伙伴肯定有印象,什么“异世相遇、尽享美味”,到了《逆水寒》这里就成了:对店员喊出「神候府查案,尔等何人?」店员需回答「炸鸡大业,不容差池!」对员工的培训指南:绝对不能笑!不止这个,这次联动还办起了舞蹈大赛,到主题店做出“闻‘基’起舞”舞蹈动作,还能获得一个摇摇乐小立牌。尬,太尬了!但就是要这

Java开发表单字段的联动与依赖功能引言:在Web开发中,表单是经常使用到的一种交互方式,用户可以通过表单填写信息并提交,而繁琐、冗余的表单字段选择操作往往会给用户带来不便。因此,表单字段的联动和依赖功能被广泛应用于提升用户体验和操作效率。本文将介绍如何使用Java开发实现表单字段的联动和依赖功能,并提供相应的代码示例。一、表单字段联动功能的实现表单

如何在Vue中实现多选下拉框在Vue开发中,下拉框是常见的表单组件之一。通常情况下,我们都使用单选下拉框来选择一个选项。但是,有时候我们需要实现多选下拉框,以便用户可以同时选择多个选项。在本文中,我们将介绍如何在Vue中实现多选下拉框,并提供具体的代码示例。一、使用ElementUI组件库ElementUI是一套基于Vue的桌面端组件库,提供了丰富的UI

网易游戏在今天宣布,《暗黑破坏神:不朽》决定联动《仙剑奇侠传》。4月24日“一剑逍遥”开启不朽修仙新时代!一个是西方魔幻的经典之作,一个是东方仙侠的永恒回忆,暗黑宇宙与仙剑江湖时空交错,两大IP携手斩妖除魔。4月24日,关于正义与侠道的不灭传说将在庇护之地上演!

元梦之星奥特曼正版联动系列,赛罗泽塔同款时装细节今日大公开,相信大家已经期待很久了,与赛罗泽塔联名时装已于今日上线,一起跟随小编来看看本次奥特曼联动的更多细节,希望能够给你带来帮助。元梦之星奥特曼正版联动:赛罗泽塔共鸣奥特之力,迸发热血火花!赛罗作为光之国新一代的年轻奥特战士终极赛罗警备队的队长赛罗奥特曼不羁又善良,热情又奔放“有我在身边,你还不放心吗?赛罗会尽全力保护星宝星宝们快穿上赛罗奥特曼时装,与赛罗一起奋勇战斗吧!细节展示建模动作展示出场动作待机动作泽塔我才不是三分之一的半吊子,我是宇宙


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
