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

📄 addmessege_jsp.java

📁 学生信息管理系统简单实现 可以简单得实现现阶段学生信息得增加 修改 删除 查看
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import sms.db.*;
import sms.bean.*;
import java.util.*;

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


  private String isSelected(String value1, String value2) {
    if (value1 != null && value2 != null && value1.equals(value2))
      return "selected";
    else
      return "";
  }

  private static java.util.Vector _jspx_dependants;

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

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

    JspFactory _jspxFactory = null;
    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 {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=gb2312");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", 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\n");
      out.write("\r\n");
      out.write('\r');
      out.write('\n');

 request.setCharacterEncoding("gb2312");
 String topic = "";
 String author = "";
 String column = "";
 String content = "";
 String commitFlag = request.getParameter("addButton");
 System.out.println("test in addMessege.jsp commitFlag:"+commitFlag);
 if(commitFlag != null){
   topic = request.getParameter("topic");
   author = request.getParameter("author");
   column = request.getParameter("column");
   content = request.getParameter("content");
   DBAccess dba = new DBAccess();
   String  sql = "insert into messege_info (topic,author,content,column_id,add_time) values('"+topic+"','"+author+"','"+content+"','"+column+"',sysdate())";
   dba.getConnection();
   int flag = dba.executeSql(sql);
   dba.closeConnection();
   if(flag > 0){
   
      out.write("\r\n");
      out.write("    <script language=\"javascript\" type=\"\">\r\n");
      out.write("    alert('添加成功!');\r\n");
      out.write("    </script>\r\n");
      out.write("    ");

   }else{
   
      out.write("\r\n");
      out.write("    <script language=\"javascript\" type=\"\">\r\n");
      out.write("    alert('添加失败!');\r\n");
      out.write("    </script>\r\n");
      out.write("    ");

   }
 }

      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("<title>添加留言板信息</title>\r\n");
      out.write("<link href=\"css/style.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write("body {\r\n");
      out.write("\tbackground-color: #CCCCCC;\r\n");
      out.write("}\r\n");
      out.write("-->\r\n");
      out.write("</style></head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("<table width=\"100%\"  border=\"0\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"33\">添加留言板信息</td>\r\n");
      out.write("  </tr>\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"367\" align=\"center\" valign=\"top\">\r\n");
      out.write("\t<form name=\"form1\" method=\"post\" action=\"addMessege.jsp\">\r\n");
      out.write("\t<table width=\"100%\" border=\"1\" bordercolorlight= #C1A4F4  borderColorDark=#ffffff cellPadding=0 cellSpacing=0 >\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td width=\"13%\" height=\"37\" align=\"right\">标题:</td>\r\n");
      out.write("\t\t<td width=\"87%\" height=\"37\" align=\"left\"><input name=\"topic\" type=\"text\" class=\"text1\" value=\"");
      out.print(topic);
      out.write("\"></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td height=\"34\" align=\"right\">作者:</td>\r\n");
      out.write("\t\t<td align=\"left\"><input name=\"author\" type=\"text\" class=\"text1\" value=\"");
      out.print(author);
      out.write("\"></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td height=\"30\" align=\"right\">栏目类型:</td>\r\n");
      out.write("\t\t<td align=\"left\">\r\n");
      out.write("\t\t<select name=\"column\" class=\"select1\">\r\n");
      out.write("\t\t  <option id=\"1\" value=\"1\" ");
      out.print(isSelected("1",column));
      out.write(">校办专栏</option>\r\n");
      out.write("\t\t  <option id=\"2\" value=\"2\" ");
      out.print(isSelected("2",column));
      out.write(">后勤管理专栏</option>\r\n");
      out.write("\t\t  <option id=\"3\" value=\"3\" ");
      out.print(isSelected("3",column));
      out.write(">教务处专栏</option>\r\n");
      out.write("\t\t  <option id=\"4\" value=\"4\" ");
      out.print(isSelected("4",column));
      out.write(">计算机中心专栏</option>\r\n");
      out.write("\t\t  <option id=\"5\" value=\"5\" ");
      out.print(isSelected("5",column));
      out.write(">招生就业专栏</option>\r\n");
      out.write("\t\t  <option id=\"6\" value=\"6\" ");
      out.print(isSelected("6",column));
      out.write(">其他专栏</option>\r\n");
      out.write("        </select></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td height=\"170\" align=\"right\" valign=\"top\">内容:</td>\r\n");
      out.write("\t\t<td align=\"left\"><textarea name=\"content\" class=\"textarea\" cols=\"20\" rows=\"10\"> ");
      out.print(content);
      out.write("</textarea></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td height=\"41\" align=\"right\">&nbsp;</td>\r\n");
      out.write("\t\t<td align=\"left\"><input name=\"addButton\" type=\"submit\" class=\"button1\" value=\"添加\"></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("    </table>\r\n");
      out.write("      </form></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

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