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

📄 dateeditimport.java

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

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

public class DateEditImport 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");
			return;
		}
		name= person.getName ().trim();
		//定义得到的时间的变量
//		String sAction = new String ();
		String sId = new String ();
		//相应的整形变量
		int nYear= 0;
		int nMonth= 0;
		int nDay= 0;
		int id=0;	
		String sStyle=new String ();
		String sType = new String ();
		String sTitle = new String ();
		String sContent=new String ();
		String sAwoke = new String ();
		//sAction = request.getParameter ("action");
		sId = request.getParameter ("id");
		if ((sId==null)||(sId.trim ()==""))
		{
			htmlOut.setErrorID (htmlOut.USER_NEED_LOGIN,"",
								"编辑重要日子时系统出现意外错误",
								"DateShowDay");
			return;
		}
		try{
			id=Integer.valueOf (sId.trim ()).intValue ();
		}catch(Exception e){
			htmlOut.setErrorID (htmlOut.USER_NEED_LOGIN,"",
								"编辑重要日子时系统出现意外错误",
								"DateShowDay");
			return;
		}
		DBOperater DB = new DBOperater ("ps_importday");
        ResultSet rs = DB.executeQuery ("select * from ps_importday where username='"+name+"' and id="+id);
		if(rs!=null){
        try{
        if( rs.next () )
		   sType=rs.getString ("DateType");
           nYear=rs.getInt ("Dateyear");
		   nMonth=rs.getInt ("DateMonth");
		   nDay=rs.getInt  ("DateDay");
		   sTitle=rs.getString ("DateTitle");
		   sContent=rs.getString ("DateContent");
		   sStyle=rs.getString ("DateStyle");
		   if(sStyle==null)
			   sStyle="";
		   if (sStyle.trim().compareTo ("每年")==0)
			   sStyle="yes";
		   else
			   sStyle="no";
		   sAwoke=rs.getString ("DateAwoke");
		   
        }
        catch(Exception e){
			DB.close ();
        	htmlOut.setErrorID (htmlOut.USER_NEED_LOGIN,"",
								"编辑重要日子时系统出现意外错误",
								"DateShowDay");
			return;
        }
   }
   DB.close ();

		//得到模板
		TemplateList tempList=CommonMethods.getDateEditImportTemplate(); 
		SingleTemplate st;
		st = tempList.searchTemplate ("ROOT");
		if(st==null)
			return ;
		//替换模板文件
		String sKey ;
		
		int nKey = st.getKeyNum ();
		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 (nYear+"");
	        if( sKey.compareTo ("月")==0)
				htmlOut.addString (nMonth+"");
			if(sKey.compareTo("日")==0)
				htmlOut.addString (nDay+"");
			if (sKey.compareTo ("标题")==0){
			    if (sTitle==null)
					sTitle="";
				htmlOut.addStringPlain (sTitle);
			}
			if (sKey.compareTo ("内容")==0){
			    if(sContent==null)
					sContent="";
				htmlOut.addString (sContent);
			}
			if (sKey.compareTo ("类型")==0)
				htmlOut.addString (sType);
            if (sKey.compareTo ("提醒")==0)
				htmlOut.addString (sAwoke);
			if (sKey.compareTo ("每年")==0)
				htmlOut.addString (sStyle);
			if (sKey.compareTo ("编号")==0)
				htmlOut.addString (sId);

	}		

	    htmlOut.addString (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 + -