2012第三章JSP标记1.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
2012第三章JSP标记1

第三章 JSP标记 !– 文件eg311.jsp -- %@ page contentType =text/html; charset=GB2312 % html body p加载的文件: jsp:include page=sum.jsp / /body /html !– 文件sum.jsp -- %@ page contentType =text/html; charset=GB2312 % html body % int sum=0; for(int i=1;i=100;i++) { sum+=i; } % p从1到100的连续和为:%=sum% /body /html 案例4 %@ page language=java contentType=text/html;charset=gb2312% html head titlejsp:forward动作指令/title /head body 使用jsp:forward动作指令实现服务器端跳转。 jsp:forward page=Forwarded.jsp/jsp:forward /body /html 案例4 Forwarded.jsp %@ page language=java contentType=text/html;charset=gb2312% html head title跳转到的页面/title /head body 跳转到的页面 /body /html !– 文件exercise.htm -- html body 提交表单,如果为指定字符串则转到一个页面,否则转到另一页面提示:“你无权访问”。 hr form action=exercise2.jsp input type=text name=myname input type=submit /form /body /html !– 文件exercise2.jsp -- %@ page contentType=text/html;charset=GB2312% html body 根据表单提交的数据跳转 hr %if(request.getParameter(myname).equals(ok)){ % jsp:forward page=exercise4.jsp/ % } else { % jsp:forward page=exercise3.jsp/ %}% /body /html !– 文件exercise4.jsp -- %@ page contentType=text/html;charset=GB2312% html body h1OK! 登录成功 /h1 /body /html !– 文件exercise3.jsp -- %@ page contentType=text/html;charset=GB2312% html body h1对不起 你无权访问 /h1 /body /html !– 文件forward_3.jsp -- %@ page contentType=text/html;charset=GBK % % request.setCharacterEncoding(GBK); % html head titleforward动作的例子/title /head body bgcolor=blue jsp:forward page=forward_4.jsp jsp:param name=name value=张飞/ jsp:param name=roles value=employee/ /jsp:forward br test br test br /body /html !– 文件forward_4.jsp -- html body bgcolor=yellow br %=request.getParameter(name)% %=request.getParameter(roles)% /body /html 案例2:使用include指令实现页面导航功能 文件名称:include.jsp HTML HEAD TITLE New Document /TITLE /HEAD BODY %@include file=public.htm% br Testbr Testbr Testbr Testbr %@include file=public.htm% /BODY /HTML 案例3 文件名称:include1.jsp %@ pa

文档评论(0)

qiwqpu54 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档