Java Web Exercises 1

Source: Internet
Author: User

1<% @pageImport= "Java.text.SimpleDateFormat"%>2<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "3pageencoding= "UTF-8"%>4<%@ pageImport= "Java.util.*"%>5<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >678<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">9<title>insert title here</title>Ten One<body> A<!--connection Generation 99 multiplication table- -<% - //String str= ""; the  for(inti=1;i<10;i++) - { -      for(intj=1;j<=i;j++) -     { +         //str+=j+ "*" +i+ "=" +j*i; -         //str+= "&nbsp;"; +         //System.out.print (j+ "*" +i+ "=" +j*i+ "\ t"); A%><%=j+ "*" +i+ "=" +j*i+ "\ T"%> at<%}%> -<%= "<br>"%> -      -<%}%> -<br> -<% inString st= ""; -  for(intq=1;q<10;q++) to { +      for(intw=1;w<=q;w++) -     { thest+=w+ "*" +q+ "=" +w*Q; *st+= "&nbsp;"; $      }Panax Notoginsengst+= "<br>"; -     } the%> +<table width= "height=" border= "1" cellpadding= "0" cellspacing= "0" style= "font:9pt;" bordercolor= "#FFFFF" > A&LT;TR&GT;&LT;TD height= "align=" Center > 99 Multiplication Table </td></tr> the&LT;TR&GT;&LT;TD style= "PADDING:3PT;" ><%=st%></td></tr> +</table> -  $<br> $<!--output full time-- -<% -Date date=NewDate (); theSimpleDateFormat sdf=NewSimpleDateFormat ("Yyyy-mm-dd HH:mm:ss"); -String today=Sdf.format (date);Wuyi%> theCurrent time: <%=today%> -<br> Wu<!--calculation 5! - -<% About intS=1; $  for(intk=1;k<=5;k++) - { -s=s*K; -     } A%> +The factorial of 5 is: <%=s%> the<br> -<!--output triangles-- $<% for(inta=1;a<=10;a++) the {   the      for(intd=1;d<=10-a;d++) the{%> the<%= "&nbsp;&nbsp;" %> -<%}%> in<% the      for(intf=1;f<=2*a-1;f++) {%> the<%= "*"%> About<%}%> the<%= "<br>"%> the<%}%> the<br> +<% -String z= ""; the   for(intx=1;x<=10;x++)Bayi  { the      for(intC=1;c<=10-x;c++) the     { -z+= "&nbsp;&nbsp;&nbsp;"; -     } the      for(intv=1;v<=2*x-1;v++) the     { thez+= "☆"; the     } -z+= "<br>"; the  } the   the%>94<%=z%> the</body> the

Output 99 multiplication table:

Output factorial and current time:

Output triangles:

Java Web Exercises 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.