In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
This article is mainly about my personal understanding of EL, OGNL and Taglib in JavaWeb.
Because the above concepts are generated on the basis of JSP, first of all, I have to talk about JSP in my eyes.
She is free and unrestrained, just like the vast sea, crossing any server barrier and running on various platforms.
It can accommodate various forms of code and tag libraries, Java native code, JSTL expressions, Struts Taglib, JSF Taglib, Webwork Taglib. All kinds of labels customized by anyone.
The basic idea of Web view layer has been expounded incisively and vividly by JSP, but people in the field of IT do not like positive old people.
At present, a dazzling variety of template engines have a great momentum to ban JSP with its flexible form of expression and concise writing style.
Back to the top.
1. Taglib (tag library) tag library
The native java code in JSP always feels messy and out of tune with the entire JSP page.
And increase the difficulty and cost of maintenance, the front-end JSP artists must also be programmers, increase the cost of program development.
Taglib is born under this premise, and it has been adopted and extended by many Javaweb mvc frameworks a long time ago.
The small and lively Taglib moves the cluttered native java code out of the world of JSP and restores the neat and clean look of JSP.
The taglib instance code is not introduced:
Name and age of user information
Introduce the struts tag and the EL expression example code:
Name and age of user information
Maybe the business logic is not complicated enough, so you may not have an uncle with a beard and become a sunny little fresh meat. It doesn't matter, listen to me slowly.
Here are some of the more mainstream TagLib, and specific references:
JSTL (JSP Standard Tag Library) developed and maintained by apache. Specific reference: http://www.runoob.com/jsp/jsp-jstl.html
Struts2 Taglib: http://www.blogjava.net/hwpok/archive/2008/10/12/233853.html
Webwork Tablib: http://wenku.baidu.com/link?url=EjR9GEfZUMw9nW3Asq6OUSTmXAuKf018QDV7
Of course, you can also customize the extension of Taglib: http://www.cnblogs.com/edwardlauxh/category/277227.html
Back to the top.
2. EL (Expression Language) expression
EL design is inspired by ECMAScript and the XPath expression language, which provides a way to simplify expressions in JSP.
EL looks for values from the Web Page, Request, Session, and Application ranges, as well as from the defined implicit objects pageScope, requestScope, sessionScope, and applicationScope.
EL is neither a programming language nor a scripting language, and the best partner is JSTL, which can use simple and convenient symbols to express and manipulate complex behaviors.
Render data code examples in EL and JSTL,Java native code HTML are not introduced:
Current user name traversed: current user organization traversed:
Introduce EL and JSTL code examples:
Current user name traversed: current user organization traversed:
${userList} is the value of EL, JSTL loop and output tag. Is the code simple and easy to understand after introducing EL and JSTL?
As for the usage and writing rules of EL and JSTL, see:
EL: https://my.oschina.net/passer007/blog/610380
JSTL: http://www.runoob.com/jsp/jsp-jstl.html
There is no point in listing these things. Search for them when you encounter specific projects and specific business rules.
Back to the top.
3. OGNL (Object-Graph Navigation Language) object graphic navigation language
OGNL is an upgraded version of EL, and the best partner is usually framework tag libraries such as struts and webwork.
OGNL provides many advanced and necessary features, such as powerful type conversion, execution of static or instance methods, cross-set projection, and dynamic lambda expression definition.
The calculation of OGNL revolves around the OGNL context, and can be used in attribute-driven frameworks such as struts and webwork... Add, delete, change, and check data in the value stack.
Introduce OGNL and struts tag library page rendering code examples:
Current object index: current user name for traversal: current user organization for traversal:
# status.index is the value of OGNL, struts tag library output and traversal notes.
The above examples are basically simple and regular examples, but the actual business logic is always accompanied by changes and complex rules, and OGNl can basically meet your requirements.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.