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

📄 selmessages_jsp.java

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

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;
import model.svc.hibernate.dao.entity.StuCourse;
import model.svc.hibernate.dao.util.HibernateService;;

public final class selMessages_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\n");
      out.write("\r\n");
      out.write("\r\n");

if(session.getAttribute("user")==null||!session.getAttribute("role").toString().equals("student")){
	response.sendRedirect("login.jsp");
return;
}
else{
	String stuId=session.getAttribute("user").toString();
	String hql1="from Groups group where group.monId="+stuId+"";
	List groups=HibernateService.execQuery(hql1);
	if(groups.size()==0){
		out.println("<script type=text/javascript>alert('您不是组长,无权查看留言');</script>");
		out.println("<meta http-equiv=\"refresh\" content=\"0;url=student.jsp\">");
	}
}
      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\" charset=\"utf-8\">\r\n");
      out.write("\t\tfunction getResult(stateVal) {\r\n");
      out.write("\t\t\tif(stateVal==\"\"){\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t\t\telse{\r\n");
      out.write("\t\t\t\tvar url = \"");
      out.print(basePath);
      out.write("GetSoftVerInfo?th_cour_id=\"+stateVal;\r\n");
      out.write("\t\t\t\tif (window.XMLHttpRequest) {\r\n");
      out.write("\t\t\t\t\treq = new XMLHttpRequest();\r\n");
      out.write("\t\t\t\t}\r\n");
      out.write("\t\t\t\telse if (window.ActiveXObject) {\r\n");
      out.write("\t\t\t\t\treq = new ActiveXObject(\"Microsoft.XMLHTTP\");\r\n");
      out.write("\t\t\t\t}\r\n");
      out.write("\t\t\t\tif(req){\r\n");
      out.write("\t\t\t\t\treq.open(\"GET\",url, true);\r\n");
      out.write("\t\t\t\t\treq.onreadystatechange = softInfo;\r\n");
      out.write("\t\t\t\t\treq.send(null);\r\n");
      out.write("\t\t\t\t}\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\tfunction softInfo()\r\n");
      out.write("\t\t{\r\n");
      out.write("\t\t\tif (req.readyState == 4) {\r\n");
      out.write("\t\t\t\tif (req.status == 200) {\r\n");
      out.write("\t\t\t\t\tvar strhtml=\"\";\r\n");
      out.write("\t\t\t\t\tvar softVerName=req.responseXML.getElementsByTagName(\"softVerName\");\r\n");
      out.write("\t\t\t\t\tvar softVerId=req.responseXML.getElementsByTagName(\"softVerId\");\r\n");
      out.write("\t\t\t\t\tstrhtml+=\"<table style='left-padding:20px;'>\";\r\n");
      out.write("\t\t\t\t\tif(softVerId.length==0||softVerId==null){}\r\n");
      out.write("\t\t\t\t\telse{\r\n");
      out.write("\t\t\t\t\t\tstrhtml+=\"<tr><td style='width:200px'>软件版本</td><td></td></tr>\";\r\n");
      out.write("\t\t\t\t\t\tfor(var i=0;i<softVerId.length;i++){\r\n");
      out.write("\t\t\t\t\t\t\t\tstrhtml+=\"<tr><td style='width:200px'>\"+softVerName[i].firstChild.data+\"</td><td><a href='");
      out.print(basePath);
      out.write("student.jsp?contr=softMessages&softVerId=\"+softVerId[i].firstChild.data+\"'>查看详细</a></td></tr>\";\r\n");
      out.write("\t\t\t\t\t\t}\r\n");
      out.write("\t\t\t\t\t}\r\n");
      out.write("\t\t\t\t\tstrhtml+=\"</table>\";\r\n");
      out.write("\t\t\t\t\t//alert(strhtml);\r\n");
      out.write("\t\t\t\t\tdocument.all.softMessageList.innerHTML=strhtml;\r\n");
      out.write("\t\t\t\t}\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\t\r\n");
      out.write("\t</script>\r\n");
      out.write("  <body>\r\n");
      out.write("  \t\t<h2>查看留言</h2>\r\n");
      out.write("\t \t<div class=\"articles\">\r\n");
      out.write("  \t\t");
  
	  		String stu_id=session.getAttribute("user").toString();
	  		String hql="from StuCourse stuCourse join fetch stuCourse.thCourse join fetch stuCourse.thCourse.courses where stuCourse.students.stuId='"+stu_id+"'";
	  		List stuCourses=HibernateService.execQuery(hql);
	  	
      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\"  onChange=\"getResult(this.value)\">\r\n");
      out.write("\t\t\t\t<option value=\"\">请选择课程</option>\r\n");
      out.write("\t\t\t\t");
for(int i=0;i<stuCourses.size();i++){
					StuCourse stuCourse=(StuCourse)stuCourses.get(i);
					out.println("<option value="+stuCourse.getThCourse().getThCourseId()+">"+stuCourse.getThCourse().getCourses().getCourName()+"</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><br>\r\n");
      out.write("\t\t\t\t<li><div id=softMessageList></div></li>\r\n");
      out.write("\t\t\t</ul>\r\n");
      out.write("\t\t</div>\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 + -