当前位置: 首页 > news >正文

甘肃建设项目公示网站遵义市和城乡建设局网站

甘肃建设项目公示网站,遵义市和城乡建设局网站,找人设计网页多少钱,温州集团网站建设公司1#xff0e;EL 表达式概述 EL#xff08;Express Lanuage#xff09;表达式可以嵌入在jsp页面内部#xff0c;减少jsp脚本的编写#xff0c;EL 出现的目的是要替代jsp页面中脚本的编写。 2#xff0e;EL从域中取出数据(EL最重要的作用) jsp脚本#xff1a;%requ…1EL 表达式概述 ELExpress Lanuage表达式可以嵌入在jsp页面内部减少jsp脚本的编写EL 出现的目的是要替代jsp页面中脚本的编写。 2EL从域中取出数据(EL最重要的作用) jsp脚本%request.getAttribute(name)% EL表达式替代上面的脚本${requestScope.name} EL最主要的作用是获得四大域中的数据格式EL表达式EL获得pageContext域中的值{EL表达式} EL获得pageContext域中的值EL表达式EL获得pageContext域中的值{pageScope.key}; EL获得request域中的值requestScope.key;EL获得session域中的值{requestScope.key}; EL获得session域中的值requestScope.key;EL获得session域中的值{sessionScope.key}; EL获得application域中的值applicationScope.key;EL从四个域中获得某个值{applicationScope.key}; EL从四个域中获得某个值applicationScope.key;EL从四个域中获得某个值{key}; —同样是依次从pageContext域request域session域application域中 获取属性在某个域中获取后将不在向后寻找 1获得普通字符串 2获得User对象的值 3获得List的值 代码如下 %page importjava.util.ArrayList% % page languagejava contentTypetext/html; charsetUTF-8pageEncodingUTF-8% % page importbeyond.domain.* % % page importjava.util.* % !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetISO-8859-1 titleInsert title here/title /head body!-- 模拟域中的数据 --%//存储一个字符串request.setAttribute(company,beyond谚语 );//存储一个对象User user new User();user.setId(1);user.setName(siqi);user.setPassword(wsq);session.setAttribute(user, user);//存储一个集合ListUser list new ArrayListUser();User user1 new User();//list集合中的第一个元素user1.setId(2);user1.setName(qibao);user1.setPassword(wsq);list.add(user1);//list集合中的第二个元素User user2 new User();user2.setId(3);user2.setName(yanyu);user2.setPassword(wsq);list.add(user2);application.setAttribute(list, list);%!-- 脚本jsp的方式取出request域中的值beyond谚语 --%request.getAttribute(company) %!-- 脚本jsp的方式取出User对象中的Namesiqi中的值 --%User sessionUser (User) session.getAttribute(user);out.write(sessionUser.getName());%hr/!-- 使用EL表达式获得request域中的值beyond谚语 --${requestScope.company}!-- 使用EL表达式获得User对象中的Name中的值siqi --${sessionScope.user.name}!-- 使用EL表达式获得 application域中的第二个元素的nameyanyu --${applicationScope.list[1].name}hr !-- 使用el表达式 全域查找 也就是把域给去掉即可--${company}${user.name}${list[1].name}/body /htmlpackage beyond.domain;public class User {private int id;private String name;private String password;public int getId() {return id;}public void setId(int id) {this.id id;}public String getName() {return name;}public void setName(String name) {this.name name;}public String getPassword() {return password;}public void setPassword(String password) {this.password password;}} 执行结果 3EL的内置对象11个 ${pageContext.request.contextPath}动态获取web应用 pageScope,requestScope,sessionScope,applicationScope ---- 获取JSP中域中的数据 param,paramValues - 接收参数. 相当于request.getParameter() request.getParameterValues() header,headerValues - 获取请求头信息 相当于request.getHeader(name) initParam - 获取全局初始化参数 相当于this.getServletContext().getInitParameter(name) cookie - WEB开发中cookie 相当于request.getCookies()—cookie.getName()—cookie.getValue() pageContext - WEB开发中的pageContext. pageContext获得其他八大对象 ${pageContext.request.contextPath} 相当于 %pageContext.getRequest().getContextPath% 这句代码不能实现 获得WEB应用的名称 //form.jsp % page languagejava contentTypetext/html; charsetUTF-8pageEncodingUTF-8% !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetUTF-8 link href${pageContext.request.contextPath}/yy.css!-- 这样的地址叫做 客户端地址 -- script typetext/javascript src${pageContext.request.contextPath}/yyy.js /script!-- 这样的地址叫做 客户端地址 -- titleInsert title here/title /head bodyform action${pageContext.request.contextPath}/el/form2.jsp methodpost%-- 只要是客户端地址 建议都要把web应用名称给写上${pageContext.request.contextPath} --%input typetext nameusernamebrinput typepassword namepasswordbrinput typecheckbox namehobby valuezq足球input typecheckbox namehobby valuepq排球input typecheckbox namehobby valueppq乒乓球brinput typesubmit value提交br/formimg alt src${pageContext.request.contextPath}/1.jpg!-- 这样的地址叫做 客户端地址 --img alt src${pageContext.request.contextPath}/2.jpg!-- 这样的地址叫做 客户端地址 --img alt src${pageContext.request.contextPath}/1.jpg!-- 这样的地址叫做 客户端地址 --!-- img alt src1.jpg这样的地址叫 相对地址跳转的时候偶尔会出现问题 -- /body /html%-- 一个发出5次请求 第一次访问该资源服务器返回该资源全部代码客户端开始接受并解析 第二次当客户端解析到link href${pageContext.request.contextPath}/yy.css!-- 这样的地址叫做 客户端地址 --的时候开始向服务器请求数据 第三次script typetext/javascript src${pageContext.request.contextPath}/yyy.js /script!-- 这样的地址叫做 客户端地址 --向服务器请求数据 第四次img alt src${pageContext.request.contextPath}/1.jpg!-- 这样的地址叫做 客户端地址 --向服务器请求数据并且缓存该图片 第五次img alt src${pageContext.request.contextPath}/2.jpg!-- 这样的地址叫做 客户端地址 --向服务器请求数据并且缓存该图片 当访问img alt src${pageContext.request.contextPath}/1.jpg!-- 这样的地址叫做 客户端地址 --的的时候发现本客户端有该图片缓存不用向服务器请求了 --% //cookie.jsp % page languagejava contentTypetext/html; charsetUTF-8pageEncodingUTF-8% !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetUTF-8 titleInsert title here/title /head body%Cookie cookie new Cookie(name,beyond);response.addCookie(cookie);//将cookie写到客户端% /body /html//form2.jsp % page languagejava contentTypetext/html; charsetUTF-8pageEncodingUTF-8% !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetUTF-8 titleInsert title here/title /head body!-- 获得表单的参数 --%request.getParameter(username);request.getParameter(password);request.getParameter(hobby);%!-- 使用el获得参数 内置对象.需要获取的数据 --${param.username}!-- 获取到usernamebeyond并输出到页面上 --${header.Host}${header[User-Agent]}!-- 因为这里的User-Agent有-特殊符号所以得使用[] --${header[Host]}!-- 能用.操作的都可以用[]操作 --${initParam.beyond.value}${cookie.name.value}!-- 访问cookie的值beyond 在页面中获得value的值--!-- 通过el表达式获得request对象 其中requestScope代表域--${pageContext.request}!-- pageContext可以获得其中八大对象 --/body /htmlweb.xml ?xml version1.0 encodingUTF-8? web-app xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlnshttp://java.sun.com/xml/ns/javaee xsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd idWebApp_ID version2.5display-nameWEB18/display-name!-- 定义全局初始化参数 --context-paramparam-namebeyond/param-nameparam-valuewsq/param-value/context-paramwelcome-file-listwelcome-fileindex.html/welcome-filewelcome-fileindex.htm/welcome-filewelcome-fileindex.jsp/welcome-filewelcome-filedefault.html/welcome-filewelcome-filedefault.htm/welcome-filewelcome-filedefault.jsp/welcome-file/welcome-file-list /web-app4EL执行表达式 例如 ${11} ${empty user} ${usernull?true:false} %page importjava.util.ArrayList% % page languagejava contentTypetext/html; charsetUTF-8pageEncodingUTF-8% % page importbeyond.domain.* % % page importjava.util.* % !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetISO-8859-1 titleInsert title here/title /head body!-- 模拟域中的数据 --%pageContext.setAttribute(company,ScriptKiddie );//存储一个字符串request.setAttribute(company,beyond谚语 );//存储一个对象User user new User();user.setId(1);user.setName(siqi);user.setPassword(wsq);session.setAttribute(user, user);//存储一个集合ListUser list new ArrayListUser();User user1 new User();//list集合中的第一个元素user1.setId(2);user1.setName(qibao);user1.setPassword(wsq);list.add(user1);//list集合中的第二个元素User user2 new User();user2.setId(3);user2.setName(yanyu);user2.setPassword(wsq);list.add(user2);application.setAttribute(list, list);%!-- 脚本jsp的方式取出request域中的值beyond谚语 --%request.getAttribute(company) %!-- 脚本jsp的方式取出User对象中的Namesiqi中的值 --%User sessionUser (User) session.getAttribute(user);out.write(sessionUser.getName());%hr/!-- 使用EL表达式获得request域中的值beyond谚语 --${requestScope.company}!-- 使用EL表达式获得User对象中的Name中的值siqi --${sessionScope.user.name}!-- 使用EL表达式获得 application域中的第二个元素的nameyanyu --${applicationScope.list[1].name}hr !-- 使用el表达式 全域查找 也就是把域给去掉即可--${company}${user.name}${list[1].name}!-- el可执行表达式的运算 --${11}!-- 2 --${11?false:true}!-- false --!-- empty 判定某个对象是否是null 如果是null返回true不是返回false --${empty list}!-- 不为null返回false --${empty user}!-- 不为null返回false --/body /html
http://wiki.neutronadmin.com/news/146613/

相关文章:

  • 做英文的小说网站有哪些wordpress公司官网主题
  • 网站投稿源码wordpress 正文替换
  • 品牌建设思维导图新网站前期seo怎么做
  • 文明网站建设管理培训心得古董做推广哪个网站好
  • 广东广东深圳网站建设网站后台如何用代码上传视频
  • 四海网络网站建设定制烟台网站网站建设
  • 网站开发与维修是什么意思广东网站开发哪家强
  • 济南网站搜索优化北京网站开发建设公司
  • 国内免费产品发布网站四川住房和城乡建设厅网站官网
  • 网站的建设可以起到什么作用是什么意思给我免费的观看
  • 网站怎么盈利太原市一页网络科技有限公司
  • 网站标题作弊详解企业微信网站建设方案
  • 西安网站设计制东莞seo网络推广专
  • 网站建设公司现在还挣钱吗网站免费建站性盈盈影院
  • 网站投票功能闵行做网站公司
  • 杭州网站建设官网蓝韵网络上海市建设工程咨询协会
  • app网站制作公司seo全网营销公司
  • 哪个网站可以做经济模拟题h5网站建设建站
  • 阿里云网站建设方案书河北建设厅查询网站
  • 百度 安徽省工程建设信息网站个人网站备案内容
  • 网站开发和微信开发需要什么人ps制作手机app界面设计
  • 成都彭州网站建设仿历史网站模板下载
  • 站群管理系统cms个人主页设计图
  • 山西天镇建站哪家好站长之家网址查询
  • 国内优秀设计网站推荐保定网站开发
  • 做博客网站需要工具吗网站可信认证必做
  • 基于php的电商网站开发广州网站建设智能 乐云践新
  • 免费拍卖网站模板做网站的怎么认证微博
  • microsoft做网站滑县网站建设策划
  • 小米网站 用什么做的企业建站找哪个公司