您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 海北分类信息网,免费分类信息发布

jsp日历表格怎么做

2024/5/15 12:04:19发布44次查看
jsp全名为java server pages,中文名叫java服务器页面,其根本是一个简化的servlet设计,它是由sun microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。jsp技术有点类似asp技术,它是在传统的网页html(标准通用标记语言的子集)文件(*.htm,*.html)中插入java程序段(scriptlet)和jsp标记(tag),从而形成jsp文件,后缀名为(*.jsp)。 用jsp开发的web应用是跨平台的,既能在linux下运行,也能在其他操作系统上运行。
日历表格完整代码:
<%@ page language="java" import="java.util.*" pageencoding="utf-8"%><%string path = request.getcontextpath();string basepath = request.getscheme()+"://"+request.getservername()+":"+request.getserverport()+path+"/";%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en"><%@page import="java.text.simpledateformat"%><%@page import="java.util.*"%><html> <head> <base href="<%=basepath%>"> <title>my jsp 'index.jsp' starting page</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="this is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--> </head> <body> <%! 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<firstweek-1){ a[j][k]=0; } else{ if(flagdate<alldays+1){ a[j][k]=flagdate; flagdate++; } } } } %> <table border="1" width="30%" align="center"> <tr> <h1 align="center"><%out.println(str); %> </tr> <div align="center"><button type="button"><img src="f:\myworkspace\datejsp\webroot\563481.png" width="30%" value="上个月"/></button> <button type="button"><img src="f:\myworkspace\datejsp\webroot\563482.png" width="30%" value="下个月"/></button> </div> <br> <tr bgcolor=#fff68f> <%for(i=1;i<8;i++){ %> <td><%=i %></td> <% }%> </tr> <% for(int j=0;j<5;j++){ %><tr><% for(int k=0;k<7;k++){ if(a[j][k]!=0){ if(a[j][k]==integer.valueof(dd)){ %><td bgcolor=#ff4500><%=a[j][k] %> </td><% continue; } %><td bgcolor="#ffffe0"><%= a[j][k] %> </td><% } else{ %><td bgcolor="#ffffe0"> </td><% } } %></tr><% } %> </table> </body></html>
以上就是​jsp日历表格怎么做的详细内容。
海北分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录