1. 程式人生 > >jsp 下拉框,前後臺傳值

jsp 下拉框,前後臺傳值

 public String add(){
  ObjectMap params=ObjectMap.newInstance();
  List rolelist=roleService.list(params,page);
  setAttribute("rolelist",rolelist);
  
  List userlist=userService.list(params,page);
  setAttribute("userlist",userlist);
  return SUCCESS;
 }     

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

                <tr>
                         <td width="15%">角色名稱</td>
                         <td width="35%">
                             <select name="ROLE_ID" id ='roleId'>
                             <option value=''>---請選擇---</option>
           <c:forEach  items="${rolelist }" var="obj">
           <option  value='${obj.ID}'>
            ${obj.NAME}
           </option>
           </c:forEach>
           </select>
                         </td>
                     </tr>

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

後臺

  bean.putRequestString("ROLE_ID");