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

📄 dateshowimport.java

📁 JAVA邮件系统
💻 JAVA
字号:
/* 
 *
 */

import java.io.*;
import java.text.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

/**

 */

public class DateShowImport extends HttpServlet {


    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
		HtmlOut htmlOut = new HtmlOut (response);
		// 得到名字和口令
		String name,pass;
		Person person = new Person();
		person.setName (CommonMethods.GetUserName(request));
		pass = CommonMethods.GetUserPass (request);
		if( person.getName ()==null || (!person.checkPassword(pass)) )
		{
           	htmlOut.setErrorID (htmlOut.USER_NEED_LOGIN,"",
								"用户不存在或用户密码错误","Login?action=reLog");
			htmlOut.outHtml();
			return;
		}
		name= person.getName ();
	    TemplateList tempList=CommonMethods.getDateShowImportTemplate ();
		SingleTemplate st;
		st = tempList.searchTemplate ("ROOT");
		if(st==null)
		{
	        htmlOut.setErrorID (htmlOut.SINGLE_TEMPLATE_NOTFIND ,"",
								"无法找到模板","DateShowDay");
			htmlOut.outHtml();
			return ;
		
		}
		String sTitle = "";
	   	int nKey = st.getKeyNum ();
		int nYear,nMonth,nDay,n=0;
		String sKey= new String ();
		String sResult=new String ();
		String sAwoke=new String ();
		String sType=new String ();
		int id;
		DBOperater DB = new DBOperater ("ps_ImportDay");
        ResultSet rs = DB.executeQuery ("select  * from ps_ImportDay where username='"+name+"'");
		if(rs!=null){
        try{
			while ( rs.next () ){
                sType=rs.getString ("DateType");
			    nYear=rs.getInt ("DateYear");
				nMonth=rs.getInt ("DateMonth");
				nDay=rs.getInt ("DateDay"); 
				sTitle=rs.getString ("DateTitle");
				if ((sTitle==null)||(sTitle.trim() ==""))
					sTitle="无标题";
				sAwoke=rs.getString ("DateAwoke");
				id=rs.getInt ("id");																  
				sResult+="<TR><td width=\"26\"><input type=\"checkbox\" name=\"idayid\" value=\"";
				sResult+=id;
				sResult+="\">";
				sResult+="<TD colSpan=2 height=19 width=\"246\">";
				sResult+="<a href=\"DateEditImport?id=";
				sResult+=id+"\">";
				sResult+=sTitle;
				sResult+="</a>";
				sResult+="</Td>";
				sResult+="<TD align=center height=\"19\" width=\"120\">";
				sResult+=nYear+"年"+nMonth+"月"+nDay+"日";
				sResult+="</td>";
				sResult+="<TD align=center height=\"19\" width=\"116\">";
				sResult+=sType;
				sResult+="</td>";
				sResult+="<TD align=center height=\"19\" width=\"130\">";
				sResult+=sAwoke;
				sResult+="</Td>";
				sResult+="</TR>";
			    n++;}
		  }
        catch(Exception e){
         }
		}
		else{
				sResult="";
				n=0;
			}
        DB.close ();
		
		//替换模板文件
         for(int i=0;i<nKey;i++){
		    	htmlOut.addString (st.getStringAt (i));
			    sKey = st.getKeyAt (i);
				if( sKey.compareTo("cgi-path")==0 )
					htmlOut.addString (CommonMethods.sHostNameCGI);
			    if( sKey.compareTo("内容")==0 )
			    	htmlOut.addString (sResult);
			    if ( sKey.compareTo("个数")==0)
				    htmlOut.addString(n+"");
		       }
		
		htmlOut.addString (st.getEndString());
		//out.println (st.getEndString());
		htmlOut.outHtml();
			
		return;
    }


    public void doPost(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
		doGet(request,response);
	}
}

⌨️ 快捷键说明

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