Utility JSP files

From GruppoZenit
Jump to: navigation, search

There are some utility JSP files provided with Z-CMS. Such files are the following:

  • jdate.jsp
  • jdb.jsp
  • jmath.jsp
  • jregexp.jsp
  • jstring.jsp
  • jsystem.jsp
  • jutil.jsp

How to use each of them is explained in the parts below.


Contents

jdate.jsp

This file creates an XHTML page for the system date.

<zcms:pagestart />
  <head>
        <zcms:pagehead />
        <title>SYSTEM DATE</title>
  </head>
  <body>
    <zcms:jsp page="#/sysjsp/jdate.jsp">
        <zcms:param name="required" value="sysdate"/>
        <zcms:param name="date_format" value="dd/MM/yyyy"/>
        <zcms:param name="date_locale" value="en"/>  
    </zcms:jsp>
    Current system date : <zcms:use name="j_sysdate" /><br/>
</body>
<zcms:pageend />

Parameters used for the system date:

  • use "#/sysjsp/jdate.jsp" URL for this purpose
  • use "required" for sysdate
  • use "dd" for date
  • use "MM" for month in digit
  • use "MMM" for month in first 3 character
  • use "MMMM" for month in full character
  • use "yyyy" or "YYYY" for year
  • use "yy" or "YY" for last 2 character year.
  • if you need Italian format, set locale "it"
  • if you need English format, set locale "en"

Note: the default date format is English.


jdb.jsp

This file creates an XHTML page for the insertion of contents.

<zcms:pagestart />
  <head>
        <zcms:pagehead />
        <title>INSERT VALUES</title>
  </head>
  <body>
    <zcms:store var="dbfields" value="fname,lname,address,city,code"/>    
    <zcms:store var="v1" value="ZCMS check insert"/>
    <zcms:store var="v2" value="Ecommerce"/>
    <zcms:store var="v3" value="Eteam"/>
    <zcms:store var="v4" value="Trivandrum"/>
    <zcms:store var="v5" value="680312"/>
    <zcms:jsp page="#/sysjsp/jdb.jsp">
      <zcms:param name="db_table" value="ED_USER"/>
      <zcms:param name="db_operation" value="insert"/>
      <zcms:param name="db_date_fields" value="datecreated"/>
      <zcms:param name="db_user_fields" value="createdby"/>
      <zcms:param name="db_fields" value="[zcms:use:dbfields]"/>
      <zcms:param name="db_value_1" value="[zcms:use:v1]"/>
      <zcms:param name="db_value_2" value="[zcms:use:v2]"/>
      <zcms:param name="db_value_3" value="[zcms:use:v3]"/>
      <zcms:param name="db_value_4" value="[zcms:use:v4]"/>
      <zcms:param name="db_value_5" value="[zcms:use:v5]"/>
    </zcms:jsp>
</body>
<zcms:pageend />

Parameters used for inserting database operations:

  • use "#/sysjsp/jdb.jsp" URL for this purpose
  • use "db_table" parameter for representing table name
  • use "db_operation" parameter for the wanted operation /* insert */
  • use "db_date_fields" parameter for representing created date
  • use "db_user_fields" parameter for representing created user id
  • use "dbfields" parameter for describing inserted fields separated by comma
  • use "db_value_1" parameter for describing inserted values corresponding to first inserted field
  • use "db_value_2" parameter for describing inserted values corresponding second inserted field.


jmath.jsp

This file creates an XHTML page for using math functions.

<zcms:pagestart />
  <head>
        <zcms:pagehead />
        <title>MATH FUNCTIONS</title>
  </head>
  <body>
    <zcms:jsp page="#/sysjsp/jmath.jsp">
      <zcms:param name="absolute" value="-5.9"/>
      <zcms:param name="max" value="50,20,10"/>
      <zcms:param name="min" value="20,30,10"/>
      <zcms:param name="round" value="560.20"/>
      <zcms:param name="ceil" value="9.3"/>
      <zcms:param name="floor" value="8.8"/>
      <zcms:param name="power" value="2,3"/>
      <zcms:param name="squareroot" value="9"/>
      <zcms:param name="cuberoot" value="27"/> 
      <zcms:param name="addition" value="10,20,40,50"/>
      <zcms:param name="subtract" value="90,30,20"/>
      <zcms:param name="multiple" value="5,8,10"/>
      <zcms:param name="division" value="40,5,2"/>
    </zcms:jsp>
    Absolute : <zcms:use name="j_absolute"/><br/>
    Maximum : <zcms:use name="j_max"/><br/>
    Minimum : <zcms:use name="j_min"/><br/>
    Round : <zcms:use name="j_round"/><br/>
    Ceil : <zcms:use name="j_ceil"/><br/>
    Floor : <zcms:use name="j_floor"/><br/>
    Power : <zcms:use name="j_power"/><br/>
    Square Root : <zcms:use name="j_squareroot"/><br/>
    Cube Root : <zcms:use name="j_cuberoot"/><br/>
    Addition : <zcms:use name="j_addition"/><br/>
    Subtract : <zcms:use name="j_subtract"/><br/>
    Multiple : <zcms:use name="j_multiple"/><br/>
    Division : <zcms:use name="j_division"/><br/>
</body>
<zcms:pageend />

Parameters used for adding math functions:

  • use "#/sysjsp/jmath.jsp" URL for this purpose.


jregexp.jsp

This file creates an XHTML page for adding regex functions.

<zcms:pagestart />
  <head>
        <zcms:pagehead />
        <title>REGEX FUNCTIONS</title>
  </head>
  <body>
    <zcms:jsp page="#/sysjsp/jregexp.jsp">
      <zcms:param name="required" value="match"/>
      <zcms:param name="value" value="word match function"/>
      <zcms:param name="regex" value="(.*)match(.*)"/> 
    </zcms:jsp>
    Match : <zcms:use name="j_match"/><br/>
    <zcms:jsp page="#/sysjsp/jregexp.jsp">
      <zcms:param name="required" value="replacefirst"/>
      <zcms:param name="value" value="word match function match"/>
      <zcms:param name="regex" value="(.*)match(.*)"/> 
      <zcms:param name="r_value" value="replaced"/>     
    </zcms:jsp>
    Replace First : <zcms:use name="j_replacefirst"/><br/> 
    <zcms:jsp page="#/sysjsp/jregexp.jsp">
      <zcms:param name="required" value="replaceall"/>
      <zcms:param name="value" value="word match function match"/>
      <zcms:param name="regex" value="match"/> 
      <zcms:param name="r_value" value="replaced"/>     
    </zcms:jsp>
    Replace All : <zcms:use name="j_replaceall"/><br/>   
</body>
<zcms:pageend />

Parameters used for inserting regex functions:

  • use "#/sysjsp/jregexp.jsp" URL for this purpose.


jstring.jsp

This file creates an XHTML page for adding string concatenation.

<zcms:pagestart />
  <head>
        <zcms:pagehead />
        <title>STRING CONCAT</title>
  </head>
  <body>
    <zcms:store var="v1" value="www"/>
    <zcms:store var="v2" value="."/>
    <zcms:store var="v3" value="gruppo"/>
    <zcms:store var="v4" value="zenit"/>
    <zcms:store var="v5" value="."/>
    <zcms:store var="v6" value="it"/>
    <zcms:jsp page="#/sysjsp/jstring.jsp">
      <zcms:param name="value_1" value="[zcms:use:v1]"/>
      <zcms:param name="value_2" value="[zcms:use:v2]"/>
      <zcms:param name="value_3" value="[zcms:use:v3]"/>
      <zcms:param name="value_4" value="[zcms:use:v4]"/>
      <zcms:param name="value_5" value="[zcms:use:v5]"/>
      <zcms:param name="value_6" value="[zcms:use:v6]"/>
    </zcms:jsp>
    <zcms:use name="j_concat"/>   
</body>
<zcms:pageend />

Parameters used for inserting string functions:

  • use "#/sysjsp/jstring.jsp" URL for this purpose
  • use "value_1" for first string
  • use "value_2" for second string and so on...


jutil.jsp

This file creates an XHTML page for adding util properties.

<zcms:pagestart />
  <head>
        <zcms:pagehead />
        <title>UTIL PROPERTY</title>
  </head>
  <body>
    <zcms:jsp page="#/sysjsp/jutil.jsp">
        <zcms:param name="enc_md5" value="zcmsjsp"/>
        <zcms:param name="enc_sha" value="zcmsadmin"/> 
        <zcms:param name="base64_encode" value="adminabc"/>
        <zcms:param name="secret_key" value="12345"/>
        <zcms:param name="base64_decode" value="YWRtaW5hYmMxMjM0NQ=="/>
        <zcms:param name="url_encode" value="http://localhost:8080/zc ms/resource.xhtml?t=1372944756212"/>
        <zcms:param name="url_decode" value="http%3A%2F%2Flocalhost%3A8080%2Fzc+ms%2Fresource.xhtml%3Ft%3D1372944756212"/>      
    </zcms:jsp>
    Encrypt MD5 : <zcms:use name="j_enc_md5" /><br/>
    Encrypt SHA1 : <zcms:use name="j_enc_sha" /><br/>
    Base64 Encoded : <zcms:use name="j_base64_encode" /><br/>
    Base64 decoded : <zcms:use name="j_base64_decode" /><br/>
    URL Encoded : <zcms:use name="j_url_encode" /><br/>
    URL Decoded : <zcms:use name="j_url_decode" /><br/>
</body>
<zcms:pageend />

Parameters used for inserting util properties:

  • use "#/sysjsp/jutil.jsp" URL for this purpose
  • use "enc_md5" to pass string for md5 encryption
  • use "j_enc_md5" to get md5 encrypt key
  • use "enc_sha" to pass string for sha1 encryption
  • use "j_enc_sha" to get sha encrypt key
  • use "base64_encode" to pass the string to encodebase64
  • use "secret_key" to pass for security, if needed
  • use "j_base64_encode" to get encodebase64 key
  • use "base64_decode" to pass the string to encoded_base
  • use "j_base64_decode" to get decodebase64 key
  • use "url_encode" to pass the string to original URL
  • use "j_url_encode" to get encodeurl key
  • use "url_decode" to pass the string to encoded URL
  • use "j_url_decode" to get decodeurl key.


jsystem.jsp

This file creates an XHTML page for system properties.

<zcms:pagestart />
  <head>
        <zcms:pagehead />
        <title>SYSTEM PROPERTY</title>
  </head>
  <body>
    <zcms:jsp page="#/sysjsp/jsystem.jsp">
        <zcms:param name="required" value="unixtime,rprotocol,rhost,rport,uniqueid"/>        
    </zcms:jsp>
    Current unix time : <zcms:use name="j_unixtime" /><br/>
    Remote address : <zcms:use name="j_rprotocol" /><br/>
    Remote host : <zcms:use name="j_rhost" /><br/>
    Remote port : <zcms:use name="j_rport" /><br/>
    Uniqueid : <zcms:use name="j_uniqueid" /><br/>
</body>
<zcms:pageend />

Parameters used for inserting system properties:

  • use "#/sysjsp/jsystem.jsp" URL for this purpose
  • use "required" for your unixtime, rprotocol, rhost, rport, uniqueid
  • use "j_unixtime" to get unixtime
  • use "j_rprotocol" to get remote protocol
  • use "j_rhost" to get remote host
  • use "j_rport" to get remote port
  • use "j_uniqueid" to get unique id.


See also

Personal tools
Namespaces

Variants
Actions
Toolbox