荣耀彩票代理

  • 热门专题

JSP的基本运行原理和语法

作者:wy  发布日期:2019-01-12 08:35:00
  •   学习东西必须深入了解,所以当我们在学习JSP时,我们可以从它的基本理论和基本语法开始,这利于我们由浅至深的去学习,加深概念理论知识的叙述。

      JSP全称是Java Server Pages它和servle技术一样,都是SUN公司定义的一种用于开发动态web资源的技术,JSP实际上就是Servlet。jsp运行原理,浏览器访问服务器上jsp页面。

      FUWUQIZHONGjsp-->FANYICHENG.javaWENJIAN-->BIANYICHENG.classWENJIAN

      jspHEservletZUIJIASHIYONGFANGSHI

      servlet:HUOQUCANSHU CHULILUOJI QINGQIUZHUANFA

    荣耀彩票代理  jsp:htmlJIEMIAN SHUJUHUIXIAN

      jspDEJIBENYUFA

      jspZHUSHI<%--ZHUSHINEIRONG--> TEDIAN:ANQUAN,SHENGLIULIANG

      网页注释:特点:不安全,费流量

      XIAOJIAOBEN <% javaDAIMA %>

      SHENGMINGCHENGYUANBIANLIANGHEFANGFA <%! %>

      XIANSHISHUJU <%= %>XIANGDANGYUout.print()

      3GEZHILING

      (1)page

      <%@page ...%>

      sessionKAIGUAN MORENKAIQI

      pageEncoding SHEZHIBENYEMIANDEBIANMAGESHI

    荣耀彩票代理  contextType: DENGTONGYUresponse.setContextType("text/html;charset=utf-8");

      errorPage: RUGUOYEMIANZHONGYOUCUOWU,ZETIAOZHUANDAOZHIDINGDEZIYUAN。

    荣耀彩票代理  isErrorPage:MORENSHIGUANBIDE KAIQIHOUKEYISHIYONGexceptionDUIXIANGLAIHUOQUYICHANGXINXI

    荣耀彩票代理  (2)include

      JINGTAIBAOHAN:BAQITAZIYUANBAOHANDAODANGQIANYEMIANZHONG。

    荣耀彩票代理  ZAIFANYISHIJIUBALIANGGEWENJIANHEBING

    荣耀彩票代理  <%@ include file="/include/1.jsp" %>

      DONGTAIBAOHAN:BUHUIHEBINGWENJIAN,DANGDAIMAZHIXINGDAOincludeSHI,CAIBAOHANLINGYIGEWENJIANDENEIRONG。

      jsp

      (3)taglib

      作用:在JSP页面中导入JSTL标签库。替换jsp中的java代码片段。

      <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

      6GEDONGZUO

       动态包含

       请求转发

       设置请求参数

      

      

      word" value="123">

      

       创建一个对象

      

       给指定的对象属性赋值

       取出指定对象的属性值

      //nameBIAOSHIYAOFUZHINEIGEDUIXIANG

      jspDE9GENEIZHIDUIXIANG

      request

      response

      session

      application

    荣耀彩票代理  exception HUOQUYICHANGXINXI MORENSHIGUANSHANGDE

    荣耀彩票代理  page DANGQIANservletSHILI this

      config

      out

      pageContext(LIYONGpageContextDUIXIANG WANGGEGEYUZHONGCUNZHI)

      CANSHU3BIAOSHIXIANGNAGEYULICUNZHI

      pageContext.setAttribute("www", "request",PageContext.REQUEST_SCOPE);

      QUANYUCHAZHAO YUCONGXIAODAODAJINXINGCHAZHAO

    荣耀彩票代理  <%=pageContext.findAttribute("www") %>

      ELBIAODASHI

      YIGESHUXIEGUIFAN,TIGONGLEjavaDAIMAZAIjspYEMIANDEJIANBIANSHUXIEFANGSHI

      GONGNENG

      1.HUOQUCUNZAI4GEZUOYONGYUZHONGDESHUJU

      ${u} XIANGDANGYU pageContext.findAttribute("u");

      ELHUOQUDUIYUnullZHEIYANGDESHUJU,ZAIYEMIANZHONGBIAOXIANWEIKONGZIFUCHUAN

      PANDUANKONGZHIDEFANGFA

      GUANJIANCI empty

    荣耀彩票代理  ${empty u}

      ZHICHISANMUPANDUAN

    荣耀彩票代理  ${empty str3?"WOSHIQIANMIANDE":"WOSHIHOUMIANDE" }

      HUOQUDUIXIANGDESHUXINGZHI javaBeanDAOHANG(DUIXIANGDAOHANG)

    荣耀彩票代理  NEIBUJIUXIANGDANGYUDIAOYONGLEgetUsername()FANGFA

    荣耀彩票代理  YONGDIANNENGHUOQUDE YONG[]DOUNENGHUOQU

    荣耀彩票代理  YONG[]HUOQUDE DIANHUOQUBULE

    荣耀彩票代理  SHIYONGYINSHIDUIXIANG ZHIDINGYUZHAODUIYINGDEZHI

      ${pageScope.xx}

    荣耀彩票代理  ${requestScope.xx }

    荣耀彩票代理  ${sessionScope.xx }

      ${applicationScope.xx }

    荣耀彩票代理  HUOQUBIAODANTIJIAODESHUJU

      ${param.username }

      ${param.password }

    荣耀彩票代理  ${paramValues.hobby[0] }

      ZHEIPIANWENZHANGSHIYIGEJICHUXINGRUMENZHISHI,DANGDAJIAZAIXUEXIJSPDEXIANGGUANZHISHISHI,BUFANGCONGZHEIYIPIANJIANDANRUXUEPIANKAISHIXUEXI。ZHAODEGANJUEYIHOUZAIKAISHIXIANGXUYAODEFANGXIANGQIANJIN,SHIYOUGEFEICHANGZHENGQUEDEXUEXIFANGSHI。

延伸阅读:

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规