Home>Article>Web Front-end> How to make jsp calendar table

How to make jsp calendar table

anonymity
anonymity Original
2019-05-29 15:06:02 3698browse

JSP全名为Java Server Pages,中文名叫java服务器页面,其根本是一个简化的Servlet设计,它是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。JSP技术有点类似ASP技术,它是在传统的网页HTML(标准通用标记语言的子集)文件(*.htm,*.html)中插入Java程序段(Scriptlet)和JSP标记(tag),从而形成JSP文件,后缀名为(*.jsp)。 用JSP开发的Web应用是跨平台的,既能在Linux下运行,也能在其他操作系统上运行。

How to make jsp calendar table

日历表格完整代码:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %>  <%@page import="java.text.SimpleDateFormat"%> <%@page import="java.util.*"%>    My JSP 'index.jsp' starting page       
<%! int i=1; int alldays=0;//变量alldays记录本月的天数; %> <%! Date date=new Date();%> <%! SimpleDateFormat format=new SimpleDateFormat("yyyy年MM月dd日"); SimpleDateFormat format1=new SimpleDateFormat("MM"); SimpleDateFormat format2=new SimpleDateFormat("dd"); String str=format.format(date);//获取日期格式为:2018年03月15日; String mm=format1.format(date);//获取 月; String dd=format2.format(date);//获取 天; Calendar date1=Calendar.getInstance(); int weekday=date1.get(Calendar.DAY_OF_WEEK_IN_MONTH)+1; int firstweek=date1.get(Calendar.DAY_OF_WEEK);//获取本月第一天星期几; int td=Integer.valueOf(dd)%7; %> <% if(mm.equals("01")||mm.equals("03")||mm.equals("05")||mm.equals("07")||mm.equals("08")||mm.equals("10")||mm.equals("12")){ alldays=31; } else if(mm.equals("02")){ alldays=29; } else{ alldays=30; } %> <% int flagdate=1; int a[][]=new int[5][7]; //int j=0,k=0; for(int j=0;j<5;j++){ for(int k=0;k<7;k++){ if(j==0&&k

<%out.println(str); %>


<%for(i=1;i<8;i++){ %> <% }%> <% for(int j=0;j<5;j++){ %><% for(int k=0;k<7;k++){ if(a[j][k]!=0){ if(a[j][k]==Integer.valueOf(dd)){ %><% continue; } %><% } else{ %><% } } %><% } %>
<%=i %>
<%=a[j][k] %> <%= a[j][k] %>

The above is the detailed content of How to make jsp calendar table. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to add css to html Next article:How to add css to html