⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 select.jsp

📁 Web开发的基本框架
💻 JSP
字号:
<%@ page contentType="text/html;charset=GBK"%>
<%@ taglib uri="/tags/web-html" prefix="html" %>
<%@ page import="java.util.*"%>
<%@ page import="html.*"%>
<%@ page import="org.loushang.web.taglib.util.*"%>
<%@ taglib uri="/tags/web-loushang" prefix="loushang"%>
<link rel="stylesheet" type="text/css" href="<loushang:ui css='css-xp1.css'/>">
<html>
<head>
<title>select组件</title>
<%
    Vector options = new Vector();
    options.add(new LabelValueBean("Label 0", "Value 0"));
    options.add(new LabelValueBean("Label 1", "Value 1"));
    options.add(new LabelValueBean("Label 2", "Value 2"));
    options.add(new LabelValueBean("Label 3", "Value 3"));
    options.add(new LabelValueBean("Label 4", "Value 4"));
    options.add(new LabelValueBean("Label 5", "Value 5"));
    options.add(new LabelValueBean("Label 6", "Value 6"));
    options.add(new LabelValueBean("Label 7", "Value 7"));
    options.add(new LabelValueBean("Label 8", "Value 8"));
    options.add(new LabelValueBean("Label 9", "Value 9"));
    request.setAttribute("options", options);  
    
	Map map = new HashMap();
	map.put("id","2");
	map.put("name","web-html组件");
	map.put("code","Value 3");
	map.put("codes",new String[]{"Value 2", "Value 4","Value 6"});
	map.put("optionsCollection",options);
    request.setAttribute(Global.getString("html.data"), map); 
%>
</head>
<body scroll="auto">
<div style="overflow:true;height:400; width:100%">
<table width="100%">
<tr>
<td><label class="title">select组件</label></td>
<% 
   String file=request.getServletPath().substring(1);
   String app=request.getContextPath();
%>
<td><label class="title">url:<%=file%></label></td>
<td align="right" valign="bottom" nowrap>&nbsp;[<a href="<%=app%>/src.jsp?target=<%=file %>" target="source">源代码</a>]&nbsp;</td>
</tr>
</table>
<hr>
<form>
<table border="0" width="100%">

    单选下拉框组件(自己增加选项):
     <html:select name="code"  property="code" size="1">
        <html:option value="Value 2">Value 2</html:option>
        <html:option value="Value 3">Value 3</html:option>
        <html:option value="Value 4">Value 4</html:option>
     </html:select>
    <p>
    
    多选下拉框组件(从集合中取选项值):
     <html:select name="codes"  property="codes" size="10" multiple="true">
        <html:options collection="options" property="value" labelProperty="label"/>
     </html:select>
    <p>
    
     单选下拉框组件(从集合中取选项值):
     <html:select name="code"  property="code" size="1">
        <html:options collection="options" property="value" labelProperty="label"/>
     </html:select>
    <p>
    
     单选下拉框组件(从集合的属性中取值):
     <html:select name="code" property="code" size="1">
        <html:optionsCollection property="optionsCollection" label="label" value="value"/>
      </html:select>
     <p>
     
     单选下拉框组件-----从集合取值和单独增加选项混合:
     <html:select name="code"  property="code" size="1">
        <html:option value="Value 1">Value 1</html:option>
	<html:options collection="options" property="value" labelProperty="label"/>
     </html:select>
</table>

</form>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -