选课系统学习笔记

***********************************************************************************1
<html>
<head>
<%@ include file="/common/meta.jsp" %>
<%@ include file="/common/calendar.jsp" %>

</head>
<body>
<input type="text" οnclick="return showCalendar(this,'%Y-%m-%d %H:%M', '24', true);"/>
</body>
</html>

***********************************************************************************2
java.sql.Clob clob = (java.sql.Clob)object[3];
String clobString="";
if(null != clob){
 try {
  clobString = clob.getSubString(1, (int)clob.length());
 } catch (SQLException e) {
  e.printStackTrace();
 }
}else {
 clobString = null;
}

***********************************************************************************3
xmlHttp.setRequestHeader("If-Modified-Since","0");

***********************************************************************************4
<script language="javascript">
 function changeCourseTime(param1,param2,param3){
  var form = document.forms[0];
  var courseTime = form.courseTime;
 
  var firstFlag = param1;
  var secondFlag = param2;
  if((firstFlag=='1'&&secondFlag=='1')||(firstFlag!='1'&&secondFlag!='1')){
   frm.submit();
  }else if(firstFlag=='1'&&secondFlag!='1'){
   for(var i=0;i<courseTime.length;i++){
    if(courseTime[i].value==param3){
     courseTime[i].selected=true;
    }
   }
   alert('请选择第一志愿!');
  }else{
   for(var i=0;i<courseTime.length;i++){
    if(courseTime[i].value==param3){
     courseTime[i].selected=true;
    }
   }
   alert('请选择第二志愿!');
  }
 }
</script>

选择上课时间
<html:select property="courseTime" οnchange="changeCourseTime('${firstFlag}','${secondFlag}','${cTime}');">
 <c:forEach items="${courseTimeList}" var="row">
  <html:option value="${row[3]}" />
 </c:forEach>
</html:select>

***********************************************************************************5
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<link rel="stylesheet" type="text/css" href="${root}/space/common/css/home.css">
<html>
<script language="javascript">
 var xmlHttp;
 var cTime = "";
 function createXMLHttpRequest()
 {
  if(window.ActiveXObject){
   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }else if(window.XMLHttpRequest){
   xmlHttp = new XMLHttpRequest();
  }
 }
 
 function closreload(c){
  cTime = c;
  createXMLHttpRequest();
  xmlHttp.onreadystatechange = handleStateChange;
  var form = document.forms[0];
  var courseId = form.courseId.value;
  var willNo = form.willNo.value;
  var willReason = form.willReason;
  var wr;
  for(var i=0;i<willReason.length;i++){
   if(willReason[i].checked){
    wr = willReason[i].value;
   }
  }
  var otherReason = form.otherReason.value;
  var url = "CourseAction.do?method=stuSaveWill&courseId="+courseId+"&willNo="+willNo+"&willReason="+wr+"&otherReason="+
   encodeURIComponent(otherReason);
  xmlHttp.open("GET",url,true);
  xmlHttp.setRequestHeader("If-Modified-Since","0");
  xmlHttp.send(null);
 }
 
 function handleStateChange(){
  if(xmlHttp.readyState == 4){
   if(xmlHttp.status == 200){
    window.parent.parent.location.href="${root}/space/course/CourseAction.do?method=stuCourseList&courseTime="+cTime;
   }
  }
 }
</script>
<body>
<center>
<html:form action="/space/course/CourseAction.do?method=stuSaveWill">
<html:hidden property="courseId"/>
<html:hidden property="willNo"/>
<table>
 <tr>
  <td>志愿顺序:</td>
  <td>
   <c:if test="${willNo eq '1'}">第一志愿</c:if>
   <c:if test="${willNo eq '2'}">第二志愿</c:if>
  </td>
 </tr>
 <tr>
  <td>选课原因:</td>
  <td>
   <html:radio property="willReason" value="0">对课程感兴趣</html:radio><br>
   <html:radio property="willReason" value="1">喜欢老师</html:radio><br>
   <html:radio property="willReason" value="2">其他</html:radio>
   <html:text property="otherReason"/>
  </td>
 </tr>
</table>
<br>
<div align="center">
  <input type="button" class="btn6" value="提交选课志愿" οnclick="closreload('${cTime}');"/>
</div>
</html:form>
</center>
</body>
</html>
<script>  
 document.all("willReason")[0].checked=true; //第一个radio选中  
</script>

***********************************************************************************6
 //张金山 学生 志愿列表
 public ActionForward stuWillList(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response) {
  String userId = (String)request.getSession().getAttribute("userId");
  List<NcmsLessonTime> list = new ArrayList<NcmsLessonTime>();
  //张金山 查询上课时间 先按星期升序排序 星期内部按上课节数升序排列
  list = ncmsLessonTimeManager.findAllLessonTimeList();
  
  List<Object[]> courseTimeWillList = new ArrayList<Object[]>();
  for(int i=0;i<list.size();i++){
   int weekday = list.get(i).getWeekday();
   int timeNo =list.get(i).getTimeNo();
   Object[] obj = new Object[2];
   String courseTime = "";
   courseTime += "上课时间" + ncmsCourseManager.getIntToString(i) + ":" + ncmsCourseManager.getCourseTime(weekday, timeNo);
   List<Object[]> willList = new ArrayList<Object[]>();
   willList = this.ncmsCourseManager.findWillList(weekday,timeNo,userId);
   obj[0] = courseTime;
   obj[1] = willList;
   courseTimeWillList.add(obj);
  }
  request.setAttribute("courseTimeWillList",courseTimeWillList);
  return mapping.findForward("stuWillList");
 }


<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="header.jsp"%>
<%@ include file="menu.jsp"%>
<%@ include file="/common/lhgdialog.jsp" %>
<style>
body{margin:0;padding:0;font:14px Verdana, Arial, sans-serif;line-height:200%;}
#content{padding-left:50px;padding-right:50px;}
#content h2{font-size:18px;color:#1E9300;padding-top:8px;margin-bottom:8px;}
#content h3{margin-top:8px;margin-bottom:8px;FONT:bold 14px 宋体,tahoma,arial,sans-serif;COLOR:#0033CC;}
#content div{margin-top:10px;margin-bottom:10px;border:#666 solid 1px;padding:10px;}
#content span{color:#f00;font-weight:bold;}
ul, ol{color:#000000;}
table{width:100%;}
</style>
<div id="right">
 <div class="header">
  <span class="title">我的志愿</span>
 </div>
 
 <div id="table">
  <c:if test="${courseTimeWillList eq null || fn:length(courseTimeWillList) eq 0 }">
   <table>
    <thead>
     <tr>
      <td style="TEXT-ALIGN: center">序号</td>
      <td style="TEXT-ALIGN: center">代码</td>
      <td style="TEXT-ALIGN: center">课程名称</td>
      <td style="TEXT-ALIGN: center">学时</td>
      <td style="TEXT-ALIGN: center">学分</td>
      <td style="TEXT-ALIGN: center">任课教师</td>
      <td style="TEXT-ALIGN: center">开课人数</td>
      <td style="TEXT-ALIGN: center">当前人数</td>
      <td style="TEXT-ALIGN: center">设定志愿</td>
     </tr>
    </thead>
    <tr><td colspan="9" style="TEXT-ALIGN: left">没有符合条件的记录. </td></tr>
   </table>
  </c:if>
  
  <c:forEach items="${courseTimeWillList}" var="willList">
   <c:set var="willList" scope="request" value="${willList}"></c:set> 
   <font size="2">${willList[0]}</font>
   <c:set var="list" scope="request" value="${willList[1]}"></c:set>
   
   <table>
    <thead>
     <tr>
      <td style="TEXT-ALIGN: center">序号</td>
      <td style="TEXT-ALIGN: center">代码</td>
      <td style="TEXT-ALIGN: center">课程名称</td>
      <td style="TEXT-ALIGN: center">学时</td>
      <td style="TEXT-ALIGN: center">学分</td>
      <td style="TEXT-ALIGN: center">任课教师</td>
      <td style="TEXT-ALIGN: center">开课人数</td>
      <td style="TEXT-ALIGN: center">设定志愿</td>
     </tr>
    </thead>
    <c:if test="${list eq null || fn:length(list) eq 0 }">
     <tr><td colspan="8" style="TEXT-ALIGN: left">没有符合条件的记录. </td>
     </tr>
    </c:if>
   
    <c:if test="${fn:length(list) ne 0 }">
     <c:forEach items="${list}" var="row">
      <tr>
            <td>
        <c:if test="${row[2] eq '1'}">第一志愿</c:if>
        <c:if test="${row[2] eq '2'}">第二志愿</c:if>
       </td>
            <td>${row[0].moduleCode }</td>
            <td>
             <a href="#" οnclick="lhgdialog.opendlg('课程介绍',
                  '${root}/space/course/CourseAction.do?method=stuCourseInfoView&courseId=${row[1]}', 600, 350,false, true );">
                  ${row[0].moduleName}
                 </a>
            </td>
            <td>${row[0].totalClass }</td>
            <td>${row[0].credit }</td>
            <td>${row[3]}</td>
            <td>${row[0].leastStudent}-${row[0].mostStudent}</td>
            <td>
             <a href="#" οnclick="lhgdialog.opendlg('选课列表',
                  '${root}/space/course/CourseAction.do?method=stuReCourseList&courseId=${row[1]}&willNo=${row[2]}&weekday=${row[4]}&timeNo=${row[5]}&willId=${row[6]}', 760, 500,false, true );">
              重新选择
             </a>
            </td>
      </tr>
     </c:forEach>
       </c:if>           
   </table>
      <br>
      <c:remove var="list"/>
      <c:remove var="willList"/>
  </c:forEach>
 </div>

<%@ include file="footer.jsp"%>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值