Jsp&Servelet 学习笔记-jsp程序介绍

时间:2010-04-05 12:06:19  来源:JSP空间网  作者:www.jspkj.net

1.2第一个jsp程序介绍:

1、 打开一个文本编辑器,或者一个jsp专用的文本编辑器能标出一些语法的高亮。
2、 如果你编写一个jsp来处理http请求那么。将会和编写html文件一样。
3、 一个jsp文件如果要包含一些Jsp命令(列如一个taglib)的话要在文件开头写上<%@%>
4、 你可以在你需要的地方输入一个普通的表单提交或者用户标签。
5、 保存文件时以.jsp为扩展名进行保存。在一个web应用中放在整个目录的顶层。既放在
Web-info同级目录下。

Example :
// 表示注释内容 <%-- --%>
<%-- use the 'taglib' directive to make the JSTL 1.0 core tags available; use the uri
"http://java.sun.com/jsp/jstl/core" for JSTL 1.1 --%>
//使用c:out标签<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%-- use the 'jsp:useBean' standard action to create the Date object; the object is set
as an attribute in page scope
--%>
//在jsp中使用javabean指明其(id)对象和(java.util.Date)类.<jsp:useBean id="date" class="java.util.Date" />

<html>
<head><title>First JSP</title></head>
<body>
<h2>Here is today's date</h2>
//使用表达式输出{data}<c:out value="{date}" />

</body>
</html>

上一篇文章:URL传递日文字符乱码问题的解决方案
下一篇文章:下面没有链接了
 最新JSP教程