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

📄 datedeldaily.java

📁 JAVA邮件系统
💻 JAVA
字号:



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

/**

 */

public class DateDelDaily 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();
		
		}
		name= person.getName ();
	   	String sYear=new String();
		String sMonth = new String ();
		String sDay = new String ();
        Calendar now = Calendar.getInstance ();
		//得到操作日期及事件id
		sYear = request.getParameter ("y");
		sMonth = request.getParameter ("m");
		sDay = request.getParameter ("d");
	    int nYear,nMonth,nDay;
		if (sYear ==null) 
			sYear="";
		if (sYear.trim ()=="")
		    nYear=now.get (now.YEAR );
		else{
			try{
			   nYear=Integer.valueOf  (sYear).intValue ();
			}catch(Exception e)
			{
				nYear = now.get(now.YEAR );
			}
		   }
		if (sMonth ==null) 
			sMonth="";
		if (sMonth.trim ()=="")
		    nMonth=now.get (now.MONTH ) + 1;
		else{
			try{
			   nMonth=Integer.valueOf  (sMonth).intValue ();
			}catch(Exception e)
			{
				nMonth = now.get(now.MONTH ) + 1;
			}
		}			
		if (sDay ==null) 
			sDay="";
		if (sDay.trim ()=="")
		    nDay=now.get (now.DATE  );
		else{
			try{
			   nDay=Integer.valueOf  (sDay).intValue ();
			}catch(Exception e)
			{
				nDay = now.get(now.DATE  );
			}
		}
	String sTitle= new String ();
	String sContent = new String ();
	sTitle = request.getParameter ("title");
	sContent = request.getParameter ("content");
	if (sTitle==null)
		sTitle ="";
	if (sContent == null)
		sContent ="";
	sTitle = CommonMethods.DealWithGBCodeOfRequest (sTitle);
	sContent = CommonMethods.DealWithGBCodeOfRequest (sContent);
		    DBOperater DB = new DBOperater ("ps_daily");
    	    DB.executeUpdate ("delete from ps_daily where username='"+name+"'and dailyyear="+nYear+"and dailyMonth="+nMonth+"and dailyDay="+nDay );
            DB.close ();
  response.sendRedirect ("DateShowDay");
    }
    public void doPost(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
		doGet(request,response);
	}
}

⌨️ 快捷键说明

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