JSP

Invoking java code with JSP scripting elements

好现在开始正式进入JSP的世界
What we need for JSP?
with**servlet**, it is easy to :
read from data
read HTTP request headers
set HTTP status codes and response headers
use cookies and session tracking
share data among servlets
remember data
get fun, high-paying job!!!
JSP makes it possible to:
use standard HTML tools such as DreamWeaver
Have different members of your team do the HTML layout than do the java programming
(队伍成员在布局的分工比在java代码的分工好)

Design Strategy: Limit Java Code in JSP Pages
提问:是把25行java代码卸载JSP页好还是25行写在java class里JSP用一行引用好?
为什么第二个好呢?
**Development**write in java environment
**Debugging**IDE helps you
**Testing**You can write a test routine with a loop that does 10,000 tests and reapply it after each change
**Reuse**You can use the same class from multiple pages.

JSP Expressions: <%= value %>

Format
<%= Java Expression %>

Controlling the Structure of Generated Servlets: The JSP page Directive

The import Attribute

<%@ page import="package.class" %>
<%@ page import="package.class1,...,package.classN" %>

The errorPage Attribute

<%@ page errorPage="Relative URL" %>

The isErrorPage Attribute

<%@ page isErrorPage="true" %> 
<%@ page isErrorPage="false" %> <%-- Default --%>

Including Files inJSP Pages

Including Pages at Request Time: jsp:include

<jsp:include page="Relative address" />

jsp:include vs @
jsp:include whenever possible
include firective has additonal power

JSP Pages with XML Syntax

<?xml version="1.0" encoding="UTF-8" ?>
<your-root-element xmlns:jsp="http://java.sun.com/JSP/Page">
    <your-tag1>foo</your-tag1>
    <your-tag2>bar</your-tag2>
<your-root-element>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值