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

📄 zy_005fedit_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;
import com.bean.util.Aca;

public final class zy_005fedit_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 'zy_edit.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("  </head>\r\n");
      out.write("  <script type=\"text/javascript\">\r\n");
      out.write("  \tfunction back() {\r\n");
      out.write("\t\thistory.go(-1);\t\r\n");
      out.write("\t}\r\n");
      out.write("  </script>\r\n");
      out.write("  <script language=\"JavaScript\" src=\"js/edit_calendar.js\"> \r\n");
      out.write("  </script> \r\n");
      out.write("  <script type=\"text/javascript\">\r\n");
      out.write("  function check()\r\n");
      out.write("  {\r\n");
      out.write("\tvar zy_name=document.all.hmmc.value;\r\n");
      out.write("\tif(zy_name==\"\")\r\n");
      out.write("  \t{\r\n");
      out.write("  \t\talert(\"请输入你的作业名称\");\r\n");
      out.write("  \t\treturn false;\r\n");
      out.write("  \t}\r\n");
      out.write("  }\r\n");
      out.write("  </script>\r\n");
      out.write("  <body>\r\n");
      out.write("  \t  \t<form name=\"zy_pub\" action=\"");
      out.print(basePath);
      out.write("Zy_edit\" method=\"post\">\r\n");
      out.write("  \t  \t\t<h2>作业编辑</h2>\r\n");
      out.write("\t \t\t<div class=\"articles\">\r\n");
      out.write("\t  \t");
  DbConn conn=new DbConn(); 
	  		String th_id=session.getAttribute("user").toString();
	  		int zypc_id=Integer.parseInt(request.getParameter("zypc_id"));
	  		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);
	  		sql="select th_course_id,zy_name,zy_instr,pub_time,zy_endtime,zypc_year,zypc_term from zy_info where zypc_id="+zypc_id+"";
	  		String[][] zy_info=conn.getData(sql);
	  		sql="select b.cour_name,a.th_course_id from courses b,th_course a,zy_info c where a.th_course_id=c.th_course_id and a.cour_id=b.cour_id and c.zypc_id="+zypc_id;
	  		String[][] present_course_info=conn.getData(sql);
	  		if(zy_info==null){
	  			out.println("暂无发布作业信息");
	  		}
	  		else{
	  	
      out.write("\r\n");
      out.write("\t\t  \t<ul style=\"list-style:none\">\r\n");
      out.write("\t\t  \t\t<li><input type='hidden' name='zypc_id' value=\"");
      out.print(zypc_id);
      out.write("\" /></li>\r\n");
      out.write("\t\t\t\t<li>作业名称: <input type=text name=hmmc value=");
      out.print(zy_info[0][1] );
      out.write("></li>\r\n");
      out.write("\t\t\t\t<li>课程名称: <select name=zy_cour_id style=\"width:150px\">\r\n");
      out.write("\t\t\t\t<option value=");
      out.print(present_course_info[0][1] );
      out.write('>');
      out.print(present_course_info[0][0] );
      out.write("</option>\r\n");
      out.write("\t\t\t\t");
for(int i=0;i<th_cour_id.length;i++){
					if(th_cour_id[i][1].equals(present_course_info[0][1]))
					{
						continue;
					}
					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<li>所属学年: <select name=acayear style=\"width:150px\">\r\n");
      out.write("\t\t\t\t");
Aca a1=new Aca();
					 
      out.write("\r\n");
      out.write("\t\t\t\t<option value=");
      out.print(zy_info[0][5] );
      out.write('>');
      out.write(' ');
      out.print(zy_info[0][5] );
      out.write("</option>\r\n");
      out.write("\t\t\t\t");
 for(int i=0;i<7;i++)
					{
						String acayear=a1.getacayear(i);
						if(acayear.equals(zy_info[0][5]))
						{
							continue;
						}
						out.print("<option value="+acayear+">"+ acayear+"</option>");
					}
				 
      out.write("\r\n");
      out.write("\t\t\t\t</select></li>\r\n");
      out.write("\t\t\t\t<li>所属学期: <select name=aca style=\"width:150px\">\r\n");
      out.write("\t\t\t\t<option ");
      out.print(zy_info[0][6] );
      out.write('>');
      out.print(zy_info[0][6] );
      out.write("</option>\r\n");
      out.write("\t\t\t\t");
 if(zy_info[0][6].equals("一")){out.print("<option value=二>"+ "二"+"</option>");}
					else{out.print("<option value=一>"+ "一"+"</option>");}
				 
      out.write("\r\n");
      out.write("\t\t\t\t\r\n");
      out.write("\t\t\t\t</select></li>\r\n");
      out.write("\t\t\t\t<li>截止日期:<input type=hidden name=deadline value=\"");
      out.print(zy_info[0][4].substring(0,10));
      out.write("\"></li>\r\n");
      out.write("\t\t\t\t<script language=javascript>\r\n");
      out.write("  \t\t\t\t\tvar myDate=new dateSelector();\r\n");
      out.write("  \t\t\t\t    myDate.inputName='end_date';  //注意这里设置输入框的name,同一页中日期输入框,不能出现重复的name。\r\n");
      out.write("  \t\t\t\t\tmyDate.display();\r\n");
      out.write("\t\t\t\t</script>\r\n");
      out.write("\t\t\t\t<li>作业说明: <textarea name=content cols=50 rows=15 style=vertical-align:bottom >");
      out.print(zy_info[0][2] );
      out.write("</textarea></li>\r\n");
      out.write("\t\t\t\t<li><div style=\"margin-left:120px\"><input type=submit name=submit value=修改 onClick=\"return check();\">\r\n");
      out.write("\t\t\t\t\t<input type=reset name=reset value=重置>\r\n");
      out.write("\t\t\t\t\t<input type=button name=cancel value=\"返回\" onclick=\"back()\">\r\n");
      out.write("\t\t\t\t\t</div>\r\n");
      out.write("\t\t\t\t</li>\r\n");
      out.write("\t\t\t</ul>\r\n");
      out.write("\t\t\t");
} 
      out.write("\r\n");
      out.write("\t\t\t</div>\r\n");
      out.write("\t\t</form>\r\n");
      out.write("    \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 + -