jsp第一次作业
上机任务
1.搭建环境,建个工程,输出hello
2.输出字母表
<%@pagelanguage="java"import="java.util.*"pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPEHTMLPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <basehref="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> </head> <body> <% for(char a='A';a<='Z';a++){ out.print(a+"("+(char)(a+32)+")"+"<br>"); } %> </body> </html>
<%@pagelanguage="java"import="java.util.*"pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPEHTMLPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <basehref="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> </head> <body> <% for(int a=1;a<=9;a++){ for(int b=1;b<=a;b++){ out.print(a+"*"+b+"="+a*b+" "); }out.print("<br>"); } %> </body> </html>