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

📄 selctrl.java

📁 文件的上传和下载的实现,用JAva编写,非常简单
💻 JAVA
字号:
package edu.whut.cwts.pg.db;

import java.util.*;


public class SelCtrl
{
    public static String toSelStr(ArrayList sels)
    {
        String result = "";
        for (int i = 0; i < sels.size(); i++)
        {
            Sel sel = (Sel) sels.get(i);
            result += "<option value=\""
                    + sel.getValue()
                    + "\">"
                    + sel.getName()
                    + "</option>";
        }
        return result;
    }

    public static String toSelStr(ArrayList sels, String selected)
    {
        if (selected == null || selected.equals("null"))
        {
            return toSelStr(sels);
        }
        String result = "";
        for (int i = 0; i < sels.size(); i++)
        {
            Sel sel = (Sel) sels.get(i);
            result += "<option value=\"" + sel.getValue() + "\" ";
            if (sel.getValue().equals(selected))
                result += " selected ";
            result += ">" + sel.getName() + "</option>";
        }
        return result;
    }

    public static String toSelStr(ArrayList sels, int selected)
    {
        return toSelStr(sels, selected + "");
    }

    public static String toSelStr(ArrayList sels, String[] selected)
    {
        String result = "";
        for (int i = 0; i < sels.size(); i++)
        {
            Sel sel = (Sel) sels.get(i);
            result += "<option value='" + sel.getValue() + "' ";
            for (int j = 0; j < selected.length; j++)
            {
                if (selected[j].equals(sel.getValue()))
                {
                    result += " selected ";
                    break;
                }
            }
            result += ">" + sel.getName() + "</option>";
        }
        return result;
    }

  

}

⌨️ 快捷键说明

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