Modify the page dynamic drop-down box

14:32:05 
<<< >>> the Controller layer
1. The first queries the physician id parameter information corresponding to the current column to
2. The physician inquiry information doctorCategoryid the current classification information for the page is determined.
List 3. query has a set of all the classification information
4. Data transfer through the front desk Model
 1 @RequestMapping("/doctorManager_update/{id}")
 2     public String doctorManagerUpdate(@PathVariable Integer id, Model model) {
 3         //查询医生,医生分类,分类列表
 4         Doctor doctor = doctorMapper.selectById(id);
 5         DoctorCategory doctorCategoryInfo = doctorCategoryDao.selectById(doctor.getDoctorCategoryid());
 6         List<DoctorCategory> list = doctorCategoryDao.selectList(null);
 7 
 8         model.addAttribute("list",list);
 9         model.addAttribute(doctor);
10         model.addAttribute("doctorCategoryInfo",doctorCategoryInfo);
11 
12         return PREFIX + "doctorManager_edit.html";
13     }

<<< >>> zone drop-down box page
1. loop through a set of data classified for.
2. Repeat filtered through option if Analyzing
1 <#select id="doctorCategoryid" name="医生职务">
2   <option value="${doctorCategoryInfo.id}" hidden="${doctorCategoryInfo.id}">${doctorCategoryInfo.type}</option>
3   @for(doctorCategory in list){
4      @if(doctorCategory.id != doctorCategoryInfo.id){
5          <option value="${doctorCategory.id}">${doctorCategory.type}</option>
</8    @}
7       @}
6   #select>

<<< >>> renderings

1. The drop-down box does not show the option selected by default

 

Guess you like

Origin www.cnblogs.com/XieXiyu/p/11201021.html