The use of jsp tags

  • 2020-05-26 09:55:45
  • OfStack

Entity bean is defined in jsp
< jsp:useBean id="clu" class="cn.domain.CacluBean" > < /jsp:useBean >
< jsp:getProperty property="propertyname" name = "clu" > Get the property value of bean and output the value to the page;

EL expression :${entity object name}
When the el expression is used to fetch data, it is usually used with the. Sign, and the. Sign.

data pageContext. findAttribute (" "); / / page request session, application find order

< ! -- when looking for bean in page, if not, create an bean -- >
< ! Content in the body of the tag is used only when bean is created (instantiated) >

jsp is assigned to bean:
< ! -- manual assignment -- >
< jsp:setProperty property="age" name="personbean" value="23" / >
< ! -- request parameter assignment, request data support string conversion to 8 basic data types -- >
< jsp:setProperty property="age" name="personbean" param="age" / >
< jsp:setProperty property="birthdty" name="personbean" value=" < %=new Date() % > " / >

< jsp:setProperty property="*" name="clu" > Set the properties of bean and assign bean with all request parameters;

// import Java class:

< %@ page import="cn.domain.*"% >
< ! -- static include: include at compile time, compile all jsp included into one servlet, the efficiency performance is better than dynamic include -- >


Related articles: