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="/static/imghwm/default1.png" data-src="F:\MyWorkSpace\DateJsp\WebRoot\563481.png" class="lazy" style="max-width:90%" value="上个月"/ alt="How to make jsp calendar table" ></button> <button type="button"><img src="/static/imghwm/default1.png" data-src="F:\MyWorkSpace\DateJsp\WebRoot\563482.png" class="lazy" style="max-width:90%" value="下个月"/ alt="How to make jsp calendar table" ></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>
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!

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.