脚本元素都包括哪些格式?都有什么内容?

JAVA学习网 2018-12-18 11:00:01

1)脚本元素有三种格式:(视频下载) (全部书籍)

   i)表达式:比如下面例子的:<%=++accessCount%>:转换代码插入到转成的Servlet的service方法。

   ii)Scriptlet:比如下面例子的: <% if (called() < 0.5) { %>  转换代码插入到转成的Servlet的service方法。

   iii)声明:比如下面例子的:<%!private int accessCount = 0;%> 或 <%!double called() { return Math.random(); 转换代码插入到转成的Servlet的service方法之外。

2)指令:比如page指令<%@ page contentType="控制整个页面或者include指令<%@ include file="url"

详情请见:http://www.mark-to-win.com/index.html?content=Jsp/jspUrl.html&chapter=Jsp/jsp3_web.html#ScriptingElementincludeWhat

阅读(10411) 评论(0)