JSP学习笔记(一)
2015-08-15 09:59
696 查看
注释:
1.单行注释<!-- -->或者//
2.多行注释<% %>
JSP脚本元素
1.JSP声明<%! %>
2.JSP表达式<%= %>
3.JSP Scriptlets<% %>
1.单行注释<!-- -->或者//
<%@ page language="java" import="java.util.*" contentType="text/html; utf-8""%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'HelloWorld.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"> --> <title> Hello,World </title> </head> <body> <!-- 打印Hello World --> <% out.print("Hello,world!"); %> </body> </html>
2.多行注释<% %>
<%@ page language="java" import="java.util.*" contentType="text/html; utf-8""%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'HelloWorld.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"> --> <title> Hello,World </title> </head> <body> <%-- 打印 Hello,world! --%> <% out.print("Hello,world!"); %> </body> </html>
JSP脚本元素
1.JSP声明<%! %>
2.JSP表达式<%= %>
3.JSP Scriptlets<% %>
<%@ page language="java" import="java.util.*" contentType="text/html; utf-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP 'HelloWorld.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"> --> <title> JSP脚本元素 </title> </head> <body> <%! int num1=1; int num2=2; int num3; int add(int num1,int num2) { return num1+num2; } %> <% num3=num1+num2; %> num1+num2=<%=add(num1,num2) %> <br> num3=<% out.println(num3);%> </body> </html>
相关文章推荐
- 38.两种数据解析(JSON和XML)
- javascript中 IE事件处理程序中try catch用法
- JavaScript 日期操作
- js用第三方插件打印lodop
- 深入javascript面向对象,js的原型链、继承
- js导入导出excel(实例代码)
- 初识Javascript的面向对象
- js的隐含参数(arguments,callee,caller)使用方法
- Arcgis for Javascript实现图
- js去除空格、换行
- JavaScript高级程序设计 第三章 --- 基本概念
- JavaScript高级程序设计笔记(2)
- js漂浮广告实现代码
- js实现点击文本框显示日期选择器特效代码分享
- js时钟翻牌效果实现代码分享
- js中setTimeout的使用
- js 函数
- js 数组&字符串 去重
- 浏览器的重排和重绘
- 【JS】<select>标签小结