📄 makelogin.java
字号:
/*
*
*/
import java.io.*;
import java.text.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
*
* @author Chen Xin Wu
*/
public class MakeLogin extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
doGet(request,response);
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
try{
HtmlOut htmlOut = new HtmlOut (response);
String sFile = CommonMethods.sHtmlPath+"/loginfirst.html" ;
File file = new File(sFile);
if( file.exists() ){
//current time;
Calendar date=Calendar.getInstance ();
//file time
long time = file.lastModified();
java.util.Date fileTime = new java.util.Date(time);
Calendar date1=Calendar.getInstance ();
date1.setTime(fileTime);
if( date1.get(date.DAY_OF_MONTH )==date.get(date.DAY_OF_MONTH ) )
response.sendRedirect ("/loginfirst.html");
return;
}
TemplateList tempList = CommonMethods.getMakeLoginTemplate ();
ReplaceEngineLogin re = new ReplaceEngineLogin();
Person p=new Person();
p.setName ("test");
if(tempList!=null){
if( !re.replace(tempList,p,htmlOut) ){
htmlOut.setErrorID (htmlOut.SHOW_SIMPLE_MESSAGE ,
"","页面生成失败!","");
}
}
else{
htmlOut.setErrorID (htmlOut.SHOW_SIMPLE_MESSAGE ,"","模板文件错误!","");
}
htmlOut.writeHtml( sFile );
htmlOut.outHtml();
}catch(Exception e){
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -