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

📄 addstu_005finfo_jsp.java

📁 vb+java实现的图书管理系统
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;
import com.bean.util.DbConn;

public final class addstu_005finfo_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');

if(session.getAttribute("user")==null||!session.getAttribute("role").toString().equals("teacher")){
response.sendRedirect("login.jsp");
return;
}
else{
}
      out.write('\r');
      out.write('\n');

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

      out.write("\r\n");
      out.write("\r\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n");
      out.write("<html>\r\n");
      out.write("  <head>\r\n");
      out.write("    <base href=\"");
      out.print(basePath);
      out.write("\">\r\n");
      out.write("    \r\n");
      out.write("    <title>My JSP 'addstu_info.jsp' starting page</title>\r\n");
      out.write("    \r\n");
      out.write("\t<meta http-equiv=\"pragma\" content=\"no-cache\">\r\n");
      out.write("\t<meta http-equiv=\"cache-control\" content=\"no-cache\">\r\n");
      out.write("\t<meta http-equiv=\"expires\" content=\"0\">    \r\n");
      out.write("\t<meta http-equiv=\"keywords\" content=\"keyword1,keyword2,keyword3\">\r\n");
      out.write("\t<meta http-equiv=\"description\" content=\"This is my page\">\r\n");
      out.write("\t<!--\r\n");
      out.write("\t<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">\r\n");
      out.write("\t-->\r\n");
      out.write("\r\n");
      out.write("  </head>\r\n");
      out.write("    <script type=\"text/javascript\">\r\n");
      out.write("  function check_null(){\r\n");
      out.write("  \tif(document.all.upload.value==\"\"){\r\n");
      out.write("     alert(\"请选择学生信息Excel!\");\r\n");
      out.write("     document.all.upload.focus();\r\n");
      out.write("     return false;\r\n");
      out.write("    }\r\n");
      out.write("    else if(document.all.class_name.value==\"\"){\r\n");
      out.write("     alert(\"请填写班级名称!\");\r\n");
      out.write("     document.all.class_name.focus();\r\n");
      out.write("     return false;\r\n");
      out.write("    }\r\n");
      out.write("  }\r\n");
      out.write("  </script>\r\n");
      out.write("  <body>\r\n");
      out.write("  \t<form name=\"frm_addstu\" action=\"");
      out.print(basePath);
      out.write("Add_stu_info\" method=\"post\" enctype=\"multipart/form-data\">\r\n");
      out.write("  \t\t<h2>导入学生信息</h2>\r\n");
      out.write("\t \t<div class=\"articles\">\r\n");
      out.write("  \t\t");
  DbConn conn=new DbConn();
	  		String th_id=session.getAttribute("user").toString();
	  		String sql="select b.cour_name,a.th_course_id from courses b,th_course a where a.th_id='"+th_id+"' and a.cour_id=b.cour_id";
	  		String[][] th_cour_id=conn.getData(sql);
	  		if(th_cour_id==null){
	  	
      out.write("\r\n");
      out.write("\t  \t\t\t您暂无授课记录!\r\n");
      out.write("\t  \t");
		
	  		}
	  		else
	  		{
	  	
      out.write("\r\n");
      out.write("\t\t  \t<ul style=\"list-style:none\">\r\n");
      out.write("\t\t\t\t<li>课 程 名 称:<select name=\"th_cour_id\" style=\"width:200px\">\r\n");
      out.write("\t\t\t\t");
for(int i=0;i<th_cour_id.length;i++){
					out.println("<option value="+th_cour_id[i][1]+">"+th_cour_id[i][0]+"</option>");
				} 
      out.write("\r\n");
      out.write("\t\t\t\t</select>\r\n");
      out.write("\t\t\t\t</li>\r\n");
      out.write("\t\t\t\t<br>\r\n");
      out.write("\t\t\t\t<br>\r\n");
      out.write("\t\t\t\t<li>班 级 名 称:<input type=text name=\"class_name\" id=\"class_name\" style=\"width:200px\"/>(选修课请添写别名)</li><br><br>\r\n");
      out.write("\t\t\t\t<li>上传学生表 :<input type=file name=\"upload\" value=\"浏览\" style=\"width:200px\" /></li><br><br>\r\n");
      out.write("\t\t\t\t<li><div style=\"margin-left:120px\"><input type=submit name=submit value=导入 onClick='return check_null();'>\r\n");
      out.write("\t\t\t\t<input type=reset name=rseset value=重置></div></li>\r\n");
      out.write("\t\t\t\t\r\n");
      out.write("\t\t\t</ul>\r\n");
      out.write("\t\t\t");
} 
      out.write("\r\n");
      out.write("\t\t</div>\r\n");
      out.write("  \t</form>\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)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

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