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

📄 guestbook_jsp.java

📁 这个是一个用JSP做的留言网站的程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package org.apache.jsp.work;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.deepteach.guestBook.*;
import java.util.ArrayList;

public final class GuestBook_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html;charset=GBK");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write('\r');
      out.write('\n');

 /*
  * ┌──────────────────── 深度学习 ──┐
  * │程序名称:留言板
  * │软件类别:功能模块
  * │授权方式:
  * │作  用:用于网站一般留言
  * │说  明:
  * │日  期:2007/8/8
  * │编写人:吕海鹏
  * └──────────────────── www.deepteach.com ──┘
  */
 
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

//-----------------定义留言板常用信息 开始 -----------------
String meta_keywords="deepteach.com,";
String meta_description="deepteach.com";
String head_title="deepteach.com,";
String siteName="深度学习(jsp)留言板";
String siteCopyRight="版权所有 deepteach.com";
int GuestBook_user_id = 0 ;	//GuestBook_user_id网站变量定义留言板用户 默认0
//-----------------定义留言板常用信息 结束 -----------------

      out.write("\r\n");
      out.write("\r\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n");
      out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n");
      out.write("<head>\r\n");
      out.write("\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=GBK\" />\r\n");
      out.write("\t<meta name=\"keywords\" content=\"");
      out.print(meta_keywords);
      out.write("\" />\r\n");
      out.write("\t<meta name=\"description\" content=\"");
      out.print(meta_description);
      out.write("\" />\r\n");
      out.write("\r\n");
      out.write("\t<title>【");
      out.print(siteName);
      out.write('】');
      out.print(head_title);
      out.write("</title>\r\n");
      out.write("\t<link href=\"styles/style_GuestBook.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t<br />\t<br />\r\n");
      out.write("\r\n");
      out.write("    <h3>");
      out.print(siteName);
      out.write("</h3>\r\n");
      out.write("    <hr width=\"90%\"/>\r\n");
      out.write("\t<br />\r\n");
      out.write("\r\n");
      out.write("<!-------留言板 开始-------------->  \r\n");

String action="noAction";
if(request.getParameter("action")!=null)
{action=request.getParameter("action");}

if ( action.equals("add") )
{

      out.write("\r\n");
      out.write("\t<script language=\"javascript\">\r\n");
      out.write("\t\tfunction check_form() {\r\n");
      out.write("\t\t\tif (document.form1.username.value==\"\")\t{\r\n");
      out.write("\t\t\t\twindow.alert(\"请输入姓名!!!\");\r\n");
      out.write("\t\t\t\tdocument.form1.username.focus();\r\n");
      out.write("\t\t\t\treturn false;\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t\t\tif (document.form1.tel.value==\"\")\t{\r\n");
      out.write("\t\t\t\twindow.alert(\"请输入电话!!!\");\r\n");
      out.write("\t\t\t\tdocument.form1.tel.focus();\r\n");
      out.write("\t\t\t\treturn false;\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t\t\tif (document.form1.email.value==\"\")\t{\r\n");
      out.write("\t\t\t\twindow.alert(\"请输入E-mail!!!\");\r\n");
      out.write("\t\t\t\tdocument.form1.email.focus();\r\n");
      out.write("\t\t\t\treturn false;\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t\t\tif (document.form1.content.value==\"\")\t{\r\n");
      out.write("\t\t\t\twindow.alert(\"请输入留言内容!!!\");\r\n");
      out.write("\t\t\t\tdocument.form1.content.focus();\r\n");
      out.write("\t\t\t\treturn false;\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t\t}\r\n");
      out.write("\t</script>\r\n");
      out.write("\t\r\n");
      out.write("\t<form id=\"form1\" name=\"form1\" method=\"post\" action=\"?action=save&GuestType=");
      out.print(request.getParameter("GuestType"));
      out.write("\" onSubmit=\"return check_form()\">\r\n");
      out.write("\t  <table width=\"95%\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"class=\"table_td_guest\">\r\n");
      out.write("\t\t<tr>\r\n");
      out.write("\t\t  <td colspan=\"2\" height=\"25\">&nbsp; 书写留言(*为必填项)</td>\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("\t\t<tr>\r\n");
      out.write("\t\t  <td align=\"center\">姓名: </td>\r\n");
      out.write("\t\t  <td><input maxlength=\"20\" size=\"14\" name=\"username\" />\r\n");
      out.write("\t\t\t*\r\n");
      out.write("\t\t\t");
if(request.getParameter("GuestType").equals("0")){ 
      out.write("\r\n");
      out.write("\t\t\t<input type=\"radio\" checked=\"checked\" value=\"GuestBook_boy.gif\" name=\"sex\" />\r\n");
      out.write("\t\t\t先生\r\n");
      out.write("\t\t\t<input type=\"radio\" value=\"GuestBook_girl.gif\" name=\"sex\" />\r\n");
      out.write("\t\t\t女士 </td>\r\n");
      out.write("\t\t\t");
} 
      out.write("\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("\t\t");
if(request.getParameter("GuestType").equals("0")){ 
      out.write("\r\n");
      out.write("\t\t<tr>\r\n");
      out.write("\t\t  <td align=\"center\">来自: </td>\r\n");
      out.write("\t\t  <td><input maxlength=\"20\" size=\"14\" name=\"from\" />\r\n");
      out.write("\t\t\t电话:\r\n");
      out.write("\t\t\t<input maxlength=\"40\" size=\"25\" name=\"tel\" />\r\n");
      out.write("\t\t\t* </td>\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("\t\t<tr>\r\n");
      out.write("\t\t  <td align=\"center\">电邮: </td>\r\n");
      out.write("\t\t  <td><input maxlength=\"100\" size=\"50\" name=\"email\" />\r\n");
      out.write("\t\t\t* </td>\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("\t\t<tr>\r\n");
      out.write("\t\t  <td align=\"center\">QQ: </td>\r\n");
      out.write("\t\t  <td><input maxlength=\"20\" size=\"50\" name=\"QQ\" />\r\n");
      out.write("\t\t  </td>\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("\t\t");
} 
      out.write("\r\n");
      out.write("\t\t<tr>\r\n");
      out.write("\t\t  <td align=\"center\">留言: </td>\r\n");
      out.write("\t\t  <td><textarea name=\"content\" rows=\"7\" cols=\"55\"></textarea>\r\n");
      out.write("\t\t\t* </td>\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("\t\t<tr>\r\n");
      out.write("\t\t  <td valign=\"top\" align=\"center\" colspan=\"2\">\r\n");
      out.write("\t\t\t");
if(request.getParameter("GuestType").equals("0")){ 
      out.write("\r\n");
      out.write("\t\t  \t\t<input type=\"submit\" value=\"留 言\" name=\"submit\" />\r\n");
      out.write("\t\t  \t");
}else{ 
      out.write("\r\n");
      out.write("\t\t  \t\t<input type=\"submit\" value=\"回 复\" name=\"submit\" />\r\n");
      out.write("\t\t  \t");
} 
      out.write("\r\n");
      out.write("\t\t\t  <input onClick=\"javascript:return confirm('此操作将清空您填写的内容,\\n您确定吗?');\" type=\"reset\" value=\"重 写\" name=\"reset\" />\r\n");
      out.write("\t\t\t  <input onClick=\"javascript:history.back();\" type=\"button\" value=\"返 回\" name=\"return\" />\r\n");
      out.write("\t\t  </td>\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("\t  </table>\r\n");
      out.write("\t</form>\r\n");

}

if (action.equals("save"))
{
		String GuestName=new String(request.getParameter("username").getBytes("iso-8859-1"));
		String GuestFace="";
		String GuestFrom="";
		String GuestTel="";
		String GuestEmail="";
		String GuestQQ="";
		if( request.getParameter("GuestType").equals("0") ){
	 GuestFace=request.getParameter("sex");
	 GuestFrom=new String(request.getParameter("from").getBytes("iso-8859-1"));
	 GuestTel=new String(request.getParameter("tel").getBytes("iso-8859-1"));
	 GuestEmail=new String(request.getParameter("email").getBytes("iso-8859-1"));

⌨️ 快捷键说明

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