Use of EL expressions in JSP for instance parsing, and example jspel expressions
El operator:
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %> <% @ page import = "java. SQL. *" %> <! DOCTYPE html>
EL processing built-in objects:
The "." and "[]" symbols are used to access data.
${applicationScope.user.username}${applicationScope.user[0].username}${applicationScope.user["user-name"]}
[]
${applicationScope.user["data"]}
Storage-related built-in objects
<! DOCTYPE html>
Input-related built-in objects
<! DOCTYPE html>
Cookie built-in object
<! DOCTYPE html>
Header built-in object
<! DOCTYPE html>
InitParam built-in object: Get environment variables set in the web site
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %> <! DOCTYPE html>
PageContex built-in object
Used to obtain detailed information about user requests and pages
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %> <! DOCTYPE html>
EL accessors:
Use accessors to read data from JavaBean
Package com. javaweb. ch08; import java. util. *; // a simple JavaBean example public class Person {// name attribute private String name; // age attribute private int age; // sex attribute private String sex; // friends attribute private ArrayList friends; // The construction method without parameters: public Person () {}// custom Construction Method: public Person (String name, int age, String sex) {this. name = name; this. age = age; this. sex = sex;} // get the name attribute value public String getName () {return name;} // get the age attribute value public int getAge () {return age ;} // obtain the sex property value public String getSex () {return sex;} // set the name attribute public void setName (String name) {this. name = name;} // set the age attribute value public void setAge (int age) {this. age = age;} // set the property value of sex public void setSex (String sex) {this. sex = sex;} // set the value of friends to public void setFriends (ArrayList friends) {this. friends = friends;} // obtain the friends attribute value public ArrayList getFriends () {return friends ;}}
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %> <% @ page import = "java. util. *, com. javaweb. ch08. * "%> <! DOCTYPE html>
Use memory to read data in Map
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %> <% @ page import = "java. util. *, com. javaweb. ch08. * "%> <! DOCTYPE html>
Use memory to read data in the array
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %> <% @ page import = "java. util. *, com. javaweb. ch08. * "%> <! DOCTYPE html>
Complex applications of memory
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %> <% @ page import = "java. util. *, com. javaweb. ch08. * "%> <! DOCTYPE html>
Articles you may be interested in:
- Solution for parsing EL expressions in JSP
- Jsp el expressions
- Jsp does not support EL expressions. Solution
- Solve the problem that EL is not supported in jsp development.