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

📄 entries.java

📁 《JSP时尚编程百例》一例源代码81-100
💻 JAVA
字号:
package cal;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.servlet.http.*;

public class Entries 
{  
    private Hashtable entries;
    private static final String[] time = {"8am", "9am", "10am", "11am", "12pm", 					"1pm", "2pm", "3pm", "4pm", "5pm", "6pm",					"7pm", "8pm" };
    public static final int rows = 12;
    
    public Entries ()
    {
        entries = new Hashtable (rows);
        for (int i=0; i < rows; i++)
        {     
            entries.put (time[i], new Entry(time[i]));
        }
    }
    
    public int getRows ()
    {
        return rows;
    }
    
    public Entry getEntry (int index)
    { 
        return (Entry)this.entries.get(time[index]);
    }
    
    public int getIndex (String tm)
    {
        for (int i=0; i<rows; i++)
            if(tm.equals(time[i])) 
                return i;    
        return -1;
    }
    
    public void processRequest (HttpServletRequest request, String tm)
    {
        int index = getIndex (tm);
        if (index >= 0)
        {
            String descr = ISOtoGb2312.convert( request.getParameter ("description") );
            ((Entry)entries.get(time[index])).setDescription (descr);
        }  
    }
}

⌨️ 快捷键说明

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