struts2 工作日志 前台页面 实现

来源:互联网 发布:我的祖国 龙应台 知乎 编辑:程序博客网 时间:2024/04/28 08:34

 <table width="100%" border="1">
  <tr>
   <td width="70">星期日</td>
   <td width="70">星期一</td>
   <td width="70">星期二</td>
   <td width="70">星期三</td>
   <td width="70">星期四</td>
   <td width="70">星期五</td>
   <td width="70">星期六</td>
    </tr>
    <TR>
   
    </TR>
    <tr>
     <c:forEach begin="1" end="${fristday-1}">
     <td width="70">
     </td>
     </c:forEach>
     <c:set var="x" value="0"></c:set>
      <c:forEach begin="1" end="${m_days}" varStatus="i">
     <td width="70">${i.index}</td>
     <c:if test="${i.index + fristday-1 == 7}">
      <c:set var="x" value="${i.index}"></c:set>
     </c:if>
     <c:if test="${i.index + fristday-1 == 7||i.index - x == 7}">
     </tr><tr>
     </c:if>
     <c:if test="${i.index + fristday-1 != 7&&i.index-x ==7}">
      <c:set var="x" value="${x+7}"></c:set>
     </c:if>
     </c:forEach>
      </tr>
</table>

就是个日历。。。
------------------------------------------------------------------------------------------------action部分代码:

 

String m = "";
  String y = "";
  
  m = ServletActionContext.getRequest().getParameter("m");
  y = ServletActionContext.getRequest().getParameter("y");
  
  if (m==null&&y==null) {
   m = Timeutil.getYearMD().substring(5,7);
   y = Timeutil.getYearMD().substring(0,4);
  }
  
  String fristDayInWeek = Timeutil.getWeekbyTimes(y+"-"+m+"-"+"01");
  int feb = (Integer.parseInt(y)%4 == 0)? 29:28;
  String[] m_days = {"31",feb+"","31","30","31","30","31","31","30","31","30","31"};
  ServletActionContext.getRequest().setAttribute("m_days",m_days[Integer.parseInt(m)-1]);
  ServletActionContext.getRequest().setAttribute("fristday",fristDayInWeek);
  ServletActionContext.getRequest().setAttribute("y",y);
  ServletActionContext.getRequest().setAttribute("m",m);
  
  return SUCCESS;


原创粉丝点击