Jsp classification cascade query selected, jsp classification level selected

Source: Internet
Author: User

Jsp classification cascade query selected, jsp classification level selected
1. This condition is that you have encapsulated all the classified data from the database into a list set. For example, city collection .. List <City> cityList the city contains all <Xihu District/gongshu district>. The District contains the last page of the residential area (such as gudang/) to return the city object .. Then loop through the jsp page. Set the drop-down and select box for conditional query.

<Li> city: </li> <select name = "cityId" class = "input2" id = "cityId"> <option value = ''> --- select --- </option> <s: iterator value = "queryAddressList" var = "fatherV"> <s: if test = "cityId = id"> <option value = "<s: property value = 'id'/> "selected =" selected "> <s: property value =" cityName "/> </option> </s: if> <s: else> <option value = "<s: property value = 'id'/>"> <s: property value = "cityName"/> </option> </s: else> <s: iterator value = "counties" var = "sonV"> <input type = "hidden" name = "father _ <s: property value = '# fatherV. id'/> "value =" <s: property value = '# sonV. countyName '/> _ <s: property value =' # sonV. id'/> "/> <s: iterator value =" blocks "var =" grandsonV "> <input type =" hidden "name =" son _ <s: property value = '# grandsonV. id '/> "value =" <s: property value =' # grandsonV. blockname'/> _ <s: property value = '# grandsonV. id '/> "/> </s: iterator> </select> </li>

<Li> region: </li> <select name = "countyId" class = "input2" id = "countyId"> <option value = "0"> --- select --- </option> <s: iterator value = "queryAddressList"> <s: if test = "cityId = id"> <s: iterator value = "counties"> <s: if test = "countyId = id"> <option value = "<s: property value =" id "/>" selected = "selected"> <s: property value = "countyName"/> </option> </s: if> <s: else> <option value = "<s: property value = "id"/> "> <s: property value =" countyName "/> </option> </s: else> </s: iterator> </s: if> </s: iterator> </select> </li>

<Li> region: </li> <select name = "blockId" class = "input2" id = "blockId"> <option value = "0" selected = "selected"> -- please select -- </option> <s: iterator value = "queryAddressList"> <s: if test = "cityId = id"> <s: iterator value = "counties"> <s: if test = "countyId = id"> <s: iterator value = "blocks"> <s: if test = "blockId = id"> <option value = "<s: property value =" id "/>" selected = "selected"> <s: property value = "blockName"/> </option> </s: if> <s: else> <option value = "<s: property value = "id"/> "> <s: property value =" blockName "/> </option> </s: else> </s: iterator> </s: if> </s: iterator> </select> </li>

$ (Function () {/** top query-switch by city search zone **/$ ("# cityId "). change (function () {var value = $ (this ). val (); $ ("# countyId "). children (). remove (); $ ("# countyId "). append ("<option value = '0'> -- select -- </option> "); $ ("input [name ^ = 'father _" + value + "']"). each (function () {var val = $ (this ). val (); $ ("# countyId "). append ("<option value = '" + val. split ("_") [1] + "'>" + val. split ("_") [0] + "</option> ");});}); /** top query-switch to area-based search **/$ ("# countyId "). change (function () {var value = $ (this ). val (); $ ("# blockId "). children (). remove (); $ ("# blockId "). append ("<option value = '0'> -- select -- </option> "); $ ("input [name ^ = 'son _" + value + "']"). each (function () {var val = $ (this ). val (); $ ("# blockId "). append ("<option value = '" + val. split ("_") [1] + "'>" + val. split ("_") [0] + "</option> ");});});});


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.