LigerUI --- Combobox, ligerui --- combobox
Preface:
Suddenly found that from the beginning of the ligerUI conflict, I feel that I have never been in touch with or will not. Now, I feel that some components of ligerUI are quite useful. It may take a long time. Hey ~~~, The drop-down box is a commonly used component. In the previous blog, I also wrote a drop-down box in ligerForm. Here I will write the Combobox drop-down box separately. Take notes ~~~~.....
Front-end Page code:
<Script type = "text/javascript"> var sysSearchSelect; $ (function () {// System Selection drop-down box sysSearchSelect =$ ("# sysSearchSelect "). ligerComboBox ({url: '$ {baseURL}/getSystemByAll. action ', valueField: 'systemid', // id textField: 'systemname' of the option value in the drop-down box, // option value in the drop-down box // initValue: 2, systemName} with systemId 2 is selected by default });}); </script> <body> <div position = "left" title = "role"> <div id = "searchbar" class = "l-searchbar"> <div> action:Private JSONArray arrSystem; public JSONArray getArrSystem () {return arrSystem;} public String getSystemByAll () throws Exception {try {List <System> systemList = systemService. getAll (System. class); arrSystem = new JSONArray (); for (System sys: systemList) {JSONObject obj = new JSONObject (); obj. put ("systemId", sys. getSystemId (); obj. put ("systemName", sys. getSystemName (); arrSystem. add (obj) ;}} catch (Exception e) {throw new BusinessException ("error in getSystemByAll query");} return "getSystemByAll ";}
The drop-down box is relatively simple. In the background, you only need to pass the two fields systemId and systemName required for the foreground page. The front-end can receive data in json format in the background, which requires some processing, in addition to providing the corresponding get Method
In addition, you need to configure the struts. xml file. For specific configuration, refer to the previous blogs (ligerGrid and ligerForm drop-down boxes.
Success: Tired, tired, tired .......... I think I'm tired now .........