jsp第一次作业

1. 搭建环境,建个工程,输出hello

<%@ 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">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
    hello. <br>
  </body>
</html>

 

2.输出字母表

<%@ 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">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
    <% for(char c='A';c<='Z';c++)
    out.print(c+"("+(char)(c+32)+")"+","); %>
  </body>
</html>

 

3.输出99乘法表

 

posted @ 2022-03-02 22:19  曲蔓特  阅读(7)  评论(0编辑  收藏  举报