当前位置:网站首页>EL&JSTL
EL&JSTL
2022-04-21 15:23:00 【Gin_ 000007】
JSP
1. Instructions effect : Used for configuration JSP page , Import resource file Format : <%@ Instruction names Property name 1= Property value 1 Property name 2= Property value 2 ... %> classification : 1. page: To configure JSP page contentType: Equate to response.setContentType() 1. Set the mime Type and character set 2. Set up current jsp Page code ( Low level tools to set pageEncoding Property before setting the character set ) errorPage: Automatically jump to the specified error page after sending an exception isErrorPage: Identifies whether the current is an error page true: yes , You can use built-in objects exception false: The default value is , Can not be 2. include: The page contains . Import page resource file <%@include file="top.jsp" %> 3. taglib: Import resources <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> prefix: Prefix , Customize
2. notes : 1. html notes : <!-- --!>: Only comment html code snippet 2. jsp notes : <%-- --%>: Can annotate all
3. Built-in objects ( Interview questions ) stay jsp There is no need to create , You can use it directly Altogether 9 individual : Variable name The real type effect pageContext PageContext The current page shares data , You can also get eight other built-in objects request HttpServletRequest One request to access multiple resources ( forward ) session HttpSession Between multiple requests in a session application ServletContext All users share data response HttpServletResponse The response object page object Current page (Servlet) The object of this out jspwriter Output object config ServletConfig Servlet Configuration objects for exception throwable Exception object
MVC Development mode
MVC: 1. M:Model Model . javab Complete specific business operations . Such as : Query the database , Encapsulated object 2. V:view View . JSP Display data 3. C:Controller controller . Servlet Get user input Call model Give the data to the view for display Advantages and disadvantages : 1. advantage : 1. Low coupling , Convenient maintenance , It's good for division of labor and cooperation 2. High reusability 2. shortcoming : 1. Complicate the project architecture , High requirements for developers
EL expression
1. effect : Replace and simplify jsp On the page java Code writing
2. grammar :${ expression }
3. Be careful :
jsp The default support el expression . If you want to ignore el expression
1. stay page Instruction set isELIgnored="true". Ignore all
2. \${ expression }: Ignore individual .
4. Use :
1. operation
Air transport operator :empty
function : Used to determine string 、 aggregate 、 Whether the array object is null Or the length is 0
${empty list}
${not empty str}
2. Get value
1. el One of the expressions gets the value from the domain object
2. grammar :
1. ${ domain name . Key name }: Gets the value of the specified key from the specified field
domain name :
1. pageScope --> pageContext
2. requestScope --> request
3. sessionScope --> session
4. applicationScope --> application(ServletContext)
request.setAttribute("name"," Zhang San ");
${requestScope.name}
2. ${ Key name }: Whether there is a value corresponding to the key in the small to large field
3. Get objects 、list aggregate 、map The value of the set
1. object :${ domain name . Key name . Property name }
Essentially, it calls getter Method
2. List aggregate :${ domain name . Key name [ Index value ]}
3. Map aggregate :
${ domain name . Key name .key name }
${ domain name . Key name ["key name "]}
3. Implicit objects :
el There is... In the expression 11 Implicit objects
pageContext:
obtain jsp other 8 Built in objects
${pageContext.request.contextPath}: Get virtual directory dynamically
JSTL
1. effect : Used to simplify and replace jsp On the page java Code 2. Use steps 1. Import jar package 2. Import label Library :taglib Instructions 3. Use a label 3. Commonly used labels 1. if: amount to java Code if sentence attribute :test It's a must attribute , receive boolean expression Expression for true Show content In general ,test Property values will be combined with el Use expressions together Be careful :c:if The label doesn't have else situation 2.choose: amount to java Code switch sentence 1.choose label amount to switch 2.when label amount to case 3.otherwise amount to default 3.foreach: amount to java Code for sentence
Three layer architecture : Software design architecture
Interface layer Business logic layer Data access layer
版权声明
本文为[Gin_ 000007]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211501520566.html
边栏推荐
- 105 page digital twin city information model CIM platform construction technical scheme
- [binary search - simple] sword finger offer II 068 Find insertion location
- What mailbox do foreign trade companies usually use and how to send e-mail in groups?
- 读书破万“卷”:国民阅读洞察2022
- 【二分搜索-简单】LCP 28. 采购方案
- 嵌入式开发:重新利用开发板进行测试的3个技巧
- 别紧张,就是聊聊软考
- How to synchronize client email to webmail and how to register email address?
- Universal navigation: a concise and practical comprehensive navigation website
- 一个简单标注库的插件化开发实践
猜你喜欢

手把手教你实现手绘风格图形

OpenHarmony相机用户态驱动框架

How do I log in to the enterprise mailbox? Enterprise mailbox login method

企业邮箱怎么登录?企业邮箱登录方法

使用konvajs三步实现一个小球游戏

Universal navigation: a concise and practical comprehensive navigation website

【JS】URLSearchParams 对象(以对象的形式上传参数到url)

Would like to ask how to find the software registration code from the database

机器学习方法创建可学习的化学语法,构建可合成的单体和聚合物

Best practices | under the epidemic, learn how eolink can help telecommuting!
随机推荐
Spark/Scala - 读取 RcFile && OrcFile
Glass: GNN tagging technique for subgraph representation learning
智慧公安二维码定位报警系统开发 移动警务app
【二分查找-简单】441. 排列硬币
MySQL
华为电力PON配网解决方案
登录重构小记
JD cloud has launched cloud computing to create an unbounded office experience for the future
How to synchronize client email to webmail and how to register email address?
JUC learning record
[binary search - simple] sword finger offer II 072 take a square root
51页数字转型与“十四五”信息化规划
【二分搜索-简单】LCP 28. 采购方案
JUC concurrent learning notes
Simple explanation of impermanence loss
[binary search - simple] sword finger offer II 068 Find insertion location
[C language] C language standard library (super complete)
[binary search - simple] 278 First wrong version
JUC学习记录
[binary search - medium] 540 A single element in an ordered array