JSP指令应用实例

实训内容和要求

编写三个 JSP 页面:first.jsp、second.jsp 和 third.jsp。另外,要求用“记事本”编写一个 hello.txt 文件。

hello.txt 中的每行都有若干个英文单词,这些单词之间用空格分隔,每行之间用
分隔,如下所示:

  1. package apple void back public
  2. <br>
  3. private throw class hello welcome

实训步骤

(1) first.jsp 的具体要求。

first.jsp 使用 page 指令设置 contentType 属性的值为 text/plain,使用 include 指令静态插入 hello.txt 文件。first.jsp 的代码如下:

  1. <%@ page contentType="text/plain" %>
  2. <html>
  3. <body>
  4. <font Size=4 color=blue>
  5. <%@ include file="hello.txt" %>
  6. </font>
  7. </body>
  8. </html>

(2) second.jsp 的具体要求。

second.jsp 使用 page 指令设置 contentType 属性的值为 application/vn.ms-powerpoint,使用 include 指令静态插入 hello.txt 文件。second.jsp 的代码如下:

  1. <%@ page contentType="application/vnd.ms-powerpoint" %>
  2. <html>
  3. <body>
  4. <font Size=2 color=blue>
  5. <%@ include file="hello.txt" %>
  6. </font>
  7. </body>
  8. </html>

(3) third.jsp 的具体要求。

third.jsp 使用 page 指令设置 contentType 属性的值为 application/msword,使用 include 指令静态插入 hello.txt 文件。third.jsp 的代码如下:

  1. <%@ page contentType="application/msword" %>
  2. <html>
  3. <body>
  4. <font Size=4 color=blue>
  5. <%@ include file="hello.txt" %>
  6. </font>
  7. </body>
  8. </html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

智慧浩海

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值