java jsp查询所有学生_用JSP实现学生查询

1 packageorg.apache.jsp;2

3 import javax.servlet.*;4 import javax.servlet.http.*;5 import javax.servlet.jsp.*;6 importjava.sql.Timestamp;7 import java.text.*;8 import java.util.*;9 import com.pojo.*;10 import com.services.*;11

12 public final class student_jsp extendsorg.apache.jasper.runtime.HttpJspBase13 implementsorg.apache.jasper.runtime.JspSourceDependent {14

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

17 private staticjava.util.List _jspx_dependants;18

19 privatejavax.el.ExpressionFactory _el_expressionfactory;20 privateorg.apache.AnnotationProcessor _jsp_annotationprocessor;21

22 publicObject getDependants() {23 return_jspx_dependants;24 }25

26 public void_jspInit() {27 _el_expressionfactory =_jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();28 _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());29 }30

31 public void_jspDestroy() {32 }33

34 public void_jspService(HttpServletRequest request, HttpServletResponse response)35 throwsjava.io.IOException, ServletException {36

37 PageContext pageContext = null;38 HttpSession session = null;39 ServletContext application = null;40 ServletConfig config = null;41 JspWriter out = null;42 Object page = this;43 JspWriter _jspx_out = null;44 PageContext _jspx_page_context = null;45

46

47 try{48 response.setContentType("text/html;charset=GB2312");49 pageContext = _jspxFactory.getPageContext(this, request, response,50 null, true, 8192, true);51 _jspx_page_context =pageContext;52 application =pageContext.getServletContext();53 config =pageContext.getServletConfig();54 session =pageContext.getSession();55 out =pageContext.getOut();56 _jspx_out =out;57

58 out.write("\r\n");59 out.write("\r\n");60 out.write("\r\n");61 out.write("\r\n");62 out.write("\r\n");63 out.write("\r\n");64 out.write("\r\n");65 out.write("\t

\r\n");66 out.write("\t\t学生信息\r\n");67 out.write("\t\r\n");68 out.write("\t\r\n");69 out.write("\t\t\r\n");70 out.write("\t\t\t出生日期:至\r\n");71 out.write("\t\t\t\r\n");72 out.write("\t\t\r\n");73 out.write("\t\t");74

75 String sBeginDate = request.getParameter("begindate");76 String sEndDate = request.getParameter("enddate");77 //将字符串转换为Timestamp

78 Timestamp beginDate = Timestamp.valueOf("1900-1-1 00:00:00");79 Timestamp endDate = Timestamp.valueOf("1900-1-1 00:00:00");80 try{81 beginDate = Timestamp.valueOf(sBeginDate+" 0:0:0");82 endDate = Timestamp.valueOf(sEndDate+" 0:0:0");83 }catch(Exception e){84 e.printStackTrace();85 }86 StudentService ss = newStudentService();87 //从数据库中查询结果

88 List l =ss.getStudentByDate(beginDate,endDate);89

90 out.write("\r\n");91 out.write("\t\t");92

93 if(l.size()!= 0 && l!=null){94

95 out.write("\r\n");96 out.write("\t\t

学号姓名出生日期性别家庭住址

106 for(Iterator iter=l.iterator();iter.hasNext();){107 Student s =iter.next();108

109 out.write("\r\n");110 out.write("\t\t\t

\r\n");111 out.write("\t\t\t\t");112 out.print(s.getSId());113 out.write("\r\n");114 out.write("\t\t\t\t");115 out.print(s.getSName());116 out.write("\r\n");117 out.write("\t\t\t\t");118 out.print(new SimpleDateFormat("yyyy-MM-dd").format(s.getSDate()));119 out.write("\r\n");120 out.write("\t\t\t\t");121 out.print(s.getSSex());122 out.write("\r\n");123 out.write("\t\t\t\t");124 out.print(s.getSAddr());125 out.write("\r\n");126 out.write("\t\t\t\r\n");127 out.write("\t\t\t");128 }129 out.write("\r\n");130 out.write("\t\t\r\n");131 out.write("\t\t");132

133 }134

135 out.write("\r\n");136 out.write("\t\r\n");137 out.write("");138 } catch(Throwable t) {139 if (!(t instanceofSkipPageException)){140 out =_jspx_out;141 if (out != null && out.getBufferSize() != 0)142 try { out.clearBuffer(); } catch(java.io.IOException e) {}143 if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);144 }145 } finally{146 _jspxFactory.releasePageContext(_jspx_page_context);147 }148 }149 }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值