Examples of various applications of El Expressions in JSP _jsp programming

Source: Internet
Author: User
Tags arithmetic arithmetic operators http request logical operators session id set cookie xmlns

el Operator:

<% @page language= "java" contenttype= "text/html;charset=gb2312"%> <% @page import= "java.sql.*"%> <! DOCTYPE html>  

El Processing built-in objects:
"." and "[]" symbols are used to access data.

${applicationscope.user.username}

${applicationscope.user[0].username}

${applicationscope.user[" User-name "]}

Passing a value through a variable must use the []

${applicationscope.user["Data"]}

Storage-related built-in objects

 <!
    DOCTYPE html>  
 

Built-in objects related to input

<! DOCTYPE html>  

Cookie built-in objects

<! DOCTYPE html>
 
 

Header Built-in Object

<! DOCTYPE html>
 
 

Initparam built-in objects: Getting the environment variables set in the Web site

<% @page language= "java" contenttype= "text/html;charset=gb2312"%>
<! DOCTYPE html>
 
 

Pagecontex built-in objects
Use to get detailed information about a user request and page

<% @page language= "java" contenttype= "text/html;charset=gb2312"%> <!
    DOCTYPE html>  

el Accessor:
reads data in JavaBean using accessors

 package com.javaweb.ch08; import java.util.*;//A simple JavaBean example public class person{//n
  Ame Property private String name;
  Age attribute private int age;
  Sex property private String sex;
  Friends property Private ArrayList friends;
    The method public person (String name,int age,string sex) {this.name = name of the parameterless constructed method public person () {}//custom constructed;
    This.age = age;
  This.sex = sex;
  }//Gets the property value of name public String GetName () {return name;
  //Get the Age property value public int getage () {return age;
  //Get Sex property value public String Getsex () {return sex;
  //Sets the property of name, public void SetName (String name) {this.name = name;
  //Set Age's property value public void setage (int age) {this.age = age;
  }//Set sex property value public void Setsex (String sex) {this.sex = sex;
  }//Set friends value public void setfriends (ArrayList friends) {this.friends = friends;
  }//Get Friends Property value Public ArrayList getfriends () {return friends; }
}

<% @page language= "java" contenttype= "text/html;charset=gb2312%> <% @page import=" java.util.*, com.javaweb.ch08.* "%> <!
    DOCTYPE html>  

Using storage to read data in a map

 <% @page language= "java" contenttype= "text/html;charset=gb2312"%> <% @page Import= "java.util.*,com.javaweb.ch08.*"%> <! DOCTYPE html>  
 

Using memory to read data in an 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>  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.