List resTypeList=(List)request.getAttribute("RESOURCE_TYPE_LIST");
页面已经获取到值
typeName
怎么遍历Id和Name值
如图,下拉框怎么遍历Id和Name
如果你只是要过去你选中的选项,用getParameter( name )就行了,不需要遍历的
如下:根据name可以取值,name与每个value组成一个键值对,取到的name的value值为列表框选中的那个的value值,当option中没有写value参数时,取到的name的value值为列表的名字;比如{
123,没加value,选择它时,value就是123
123,加了value,选择它时,value就是456
}
请选择父菜单
<%
MenuImpl menuImpl = new MenuImpl();
List listMenuEntities = menuImpl.find(0);
for(MenuEntity menuEntitys: listMenuEntities){
%>
如下:根据name可以取值,name与每个value组成一个键值对,取到的name的value值为列表框选中的那个的value值,当option中没有写value参数时,取到的name的value值为列表的名字;比如{
```<!-- 比如123,没加value,选择它时,value就是123 -->
```<select name="select">
<option value="0">请选择父菜单</option>
<%
MenuImpl menuImpl = new MenuImpl();
List<MenuEntity> listMenuEntities = menuImpl.find(0);
for(MenuEntity menuEntitys: listMenuEntities){
%>
<option value="<%=menuEntitys.getId() %>" <%if(menuEntity.getParentmenu() == menuEntitys.getId()) out.print("selected='selected'");%>><%=menuEntitys.getName() %></option>
<%
}
%>
</select>