欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    【精品文档】532关于计算机专业JSP表达式语言介绍简介概述的毕业设计论文英文英语外文文献翻译成品资料:JSP和EL介绍中英文双语对照15文档格式.docx

    • 资源ID:852359       资源大小:1.08MB        全文页数:35页
    • 资源格式: DOCX        下载积分:15金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    【精品文档】532关于计算机专业JSP表达式语言介绍简介概述的毕业设计论文英文英语外文文献翻译成品资料:JSP和EL介绍中英文双语对照15文档格式.docx

    1、Unlike the earlier chapters, this chapter provides a more in-depth exploration of a cornerstone element of the JSP standard: JSPs Expression Language, or EL for short.In this chapter, you will discover the following: Why EL is an indispensable part of JSP 2.0 How to use EL named variables How to per

    2、form type conversion and coercion in EL How to handle null values in EL How to work with arithmetic, logical, comparison, and other operators in EL The different ways of accessing members of a collection in EL How to access properties of objects in EL How to access nested object properties in EL How

    3、 to use implicit objects in EL How to define and access functions in EL How to use a namespace when referencing EL functionsThis chapter covers a lot of ground, and includes five separate examples. By the end of the chapter, you should be very familiar with EL, and be comfortable using it in your ow

    4、n applications.EL and Its Vital Role in JSPEL was not part of the JSP standard prior to 2.0. One of the main reasons for creating EL was to ensure that presentation-level JSP pages could be created without relying on scripting elements. Chapter 3, “JSP Basics 2: Generalized Templating and Server Scr

    5、ipting,” covered the use of scripting elements (typically code written in Java) that are embedded within a JSP page.The need for scripting elements within JSP is typically driven by the requirements of an application.Major application requirements that demand the use of scripting elements include th

    6、e following: To provide control-flow for JSP execution To set, and subsequently access, variables that are local to the JSP page To render a value from a complex expression that involves Java objects To access properties of an arbitrary Java object To call methods of JavaBeans or other Java objectsU

    7、nfortunately, experience has shown that the use of scripting elements in JSPs makes large projects diffi-cult to maintain over the long term. It also encourages programming practices that may tightly couple the presentation (user interface) of an application to its business logic, reducing its flexi

    8、bility and scala-bility. This is a highly undesirable practice in the creation of Web applications and services. Ideally, JSPs should be created free of scripting elements if at all possible.In order to create a JSP version that can work completely free of scripting elements, it is essential that al

    9、l five of the application requirements can be satisfied without the use of embedded Java coding. JSP 2.0 satisfies these requirements. The first two items are handled by JSTL (explored in detail in Chapter 6, “JSP Tag Libraries and JSTL”), while the last three requirements are handled by EL.EL is in

    10、dependent of JSP 2.0. Despite the vital role of EL in JSP 2.0, the use of EL is not exclusive to JSP containers. The EL parser is also not tightly integrated into the JSP parser, but can be detached and reused for other purposes. In fact, EL is incorporated into both Java Server Faces (JSF, a server

    11、-side GUI construction kit technology; see Chapter 21, “JavaServer Faces,” for more information), and JSTL. Therefore, becoming familiar with EL will save you time when exploring these other technologies.EL Named VariablesWhen working with EL (and JSTL), you will frequently work with named variables

    12、. Named variables in EL refer to attributes attached to JSP scoping objects. For example, the following EL expression will ren-der the value of the named variable called bearCount:The EL parser will search for the attribute through the various JSP scoping objects in the following order:1Page2.Reques

    13、tSession (if currently valid)ApplicationIn practice, this is equivalent to a call to the Java PageContext.findAttribute() method. If you are maintaining legacy JSP code with embedded Java, you may see this call. You can consult the JSP Javadocs (API documentation) to see how this method works.Figure

    14、 5-1 illustrates the search for an EL named variable.Figure 5-1: Order of search for an EL named variableIn Figure 5-1, you can see the search order for an EL named variable: First the set of EL implicit objects is searched for a matching name (EL implicit objects are covered later in this chapter),

    15、 and then the four scopes. If the named variable is not found, some action may create it.If the attribute with the specified name cannot be located in any scope, a null value is returned. The null value will render as a “” (empty string) in the output, and will not trigger any error.Applying ELAs th

    16、e name implies, the Expression Language works with expressions. It is a programming language used in the construction of expressions. All EL expressions are enclosed in the $. notation. The expression is evaluated before the rest of the JSP is evaluated. You can place EL expressions in two places wi

    17、thin a JSP: Inline with template data Within attributes of JSP actions, standard or customUsing EL expressions inline with template dataThe most typical use of EL expressions is to render a textual string inline with template data. For example, consider the following JSP fragment:There are $5 + 1 be

    18、ars in the cave.In this case, the EL expression is placed inline with the HTML template data. At JSP processing time, the expression $5+1 will evaluate to 6, and be placed at the same position as the original expression. This will result in the following HTML:There are 6 bears in the cave. 100000”Ri

    19、ch cousin!br/c:ifIn this case, the EL expression $salary 100000 is used to conditionally render the body of the JSTL tag. It is placed in the test attribute of the custom JSTL action. This will cause the EL expression to be evaluated before the JSTL custom action is evaluated. The HTML will be rende

    20、red only if the named variable called salary is greater in value than 100,000.For example, consider the following JSP fragment featuring the JSTL tag:set var=”datetime” val=$dateNow - $timeNow/If the dateNow named variable contains the string “May 1, 2005” and timeNow contains “11:00 AM”, then the r

    21、esulting datetime named variable will contain “May 1, 2005 - 11:00 AM”.As shown in the preceding section, an EL expression can be an arithmetic expression, or an expression featuring a comparison. The following Try It Out section explores some of these EL expressions.To try out the first example, de

    22、ploy ch05.war to your Tomcat 5 server. Review Chapter 1 if you do not remember how to deploy a WAR file.Access the following URL using your browser to see the examples output:http:/localhost:8080/ch05/example1/You should see something similar to what is shown in Figure 5-2.Figure 5-2: Output result

    23、of EL expressionsThe output in Figure 5-2 is the result of a collection of different EL expressions. The following How It Works section examines the EL expressions used to generate this output.How It WorksThe JSP used to generate the output shown in Figure 5-2 is located at Tomcat Installation Note

    24、that operator precedence has caused the multiplication and division to be executed first. Furthermore, the calculation has caused a decimal to appear in the output. You can use the numeric formatting tags in JSTL to eliminate this. For example, the following JSP fragment in index.jsp renders the sam

    25、e result with-out the decimal point.The formatNumber JSTL tag is used to format the numerical output, using a pattern that specifies no decimal point should be displayed. This results in the following output.Comparison operatorsEL supports the entire range of comparison operators found in most progr

    26、amming languages. Each of the operators has a symbolic form and an abbreviated textual form. The following table enumerates the available operators.Note that in the previous comparison EL always attempts to convert the type of the data being com-pared “in the right way.” That is, the character data

    27、is converted to numeric value before being com-pared, except in the case where two characters are compared.In the previous example, the empty string “” is considered empty while any other string value is not. A nonexistent variable, Junk, is given a null value in EL. This null value is considered em

    28、pty when tested with the empty operator. On the other hand, the guess variable exists (used earlier) and therefore is not empty. In other words, depending on the data type of the operand, the empty operator can also be used to test for the conditions shown in the following table.The named variable S

    29、trVar is initially set to the string true. This is a variable of type String. However, because the test attribute of the JSTL tag requires a Boolean expression, it is automatically con-verted to a Boolean by EL before use. This causes the printing of the “equal!” message.Finally, the comparison operator is being used on the special null value. It is shown


    注意事项

    本文(【精品文档】532关于计算机专业JSP表达式语言介绍简介概述的毕业设计论文英文英语外文文献翻译成品资料:JSP和EL介绍中英文双语对照15文档格式.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开