WEB master

Jetty 
Jetty is an open source Java web server, as well as a servlet container, that provides an application with the features required to launch and run an application servlet or API. While web servers are usually associated with serving documents to people, Jetty is now often used for machine to machine communications, usually within larger software frameworks. Jetty is developed as a free and open source project as part of the Eclipse Foundation.

Jetty has the ability to run an application like a traditional application server like Tomcat or Wildfly in what is called Standalone deployment.This isn't really anything special, however, Jetty also has the functionality to operate as a servlet that is embedded in your existing application. This allows you to not run an application in Jetty but to run Jetty in your application.

There are some distinct advantages, including better self-contained applications, the ability to test against server like application dependencies, more control of custom filters, headers and caching, and single object deployment. Essentially, these advantages improve application development time specifically in development as developers are able to simplify their manual testing.

Jetty is used in a variety of different ways, from local development all the way to true enterprise deployment. Jetty is lightweight free server with a low memory footprint that prides its self on excellent scalability, which helps development teams scale their application throughout their software development lifecycle. Therefore, teams that want to leverage development into the cloud or use a healthy amount of microservices without changing their application architecture in deployment into production lean toward Jetty.

Not only is Jetty going to provide simplified configuration and fully contained services that add to the increased scalability, but Jetty’s low memory footprint further increases the scalability. That low memory footprint lowers unwanted overhead on an application. This allows a developer’s restart time to decrease significantly in local development, sometimes up to 16x faster, meaning a developer can now test more frequently without using up as much time waiting for services to start

Hogan.js
Hogan.js uses mustache template language as the template syntax, and its very simple and straightforward.Hogan is fast--try it on your workload.Hogan has separate scanning, parsing and code generation phases. This way it's possible to add new features without touching the scanner at all, and many different code generation techniques can be tried without changing the parser. Hogan exposes scan and parse methods. These can be useful for pre-processing templates on the server.
  • Less 
Less (Leaner Style Sheets; sometimes stylized as LESS) is a dynamic preprocessor style sheet language that can be compiled into Cascading Style Sheets (CSS) and run on the client side or server side.File extension is .less. less extension files contain CSS code with programmable feature syntax. The files created with the .less extension are read and parsed by compilers only. javascript has compilers and preprocesses less code to generate CSS content.


  • Cookies are small bits of textual information that a Web server sends to a browser and that the browser returns unchanged when visiting the same Web site or domain later

  • Do you suffer with ï»¿ when including htm/html in FTL.Use Encode type in your include tag  ex: "<#include "plugin.privateTermsAndConditionEN.htm" encoding="UTF-8" />"
  •  " & nbsp; " use this for adding spaces in ftl,html.(* please remove space between the & and n :) i had to put that space blog it self consider as space)



  • Class path
Jboss -   
               With Jboss we cannot  use * mark for represent all files, we need to import all files separately.

Tomcat -  
               With Tomcat * mark support 

Websphere - 
               With Websphere we need extra * mark than Tomcat class path representation


  • JQUERY Selectors
Jquery selecters ease us to handle the HTML elements  based on their id, classes, types, attributes, values of attributes etc.

This collection I got from W3School


  1. *            -    $("*")                 -    All elements
  2. #id         -    $("#lastname")    -  The element with id=lastname
  3. .class      - $(".intro")           -       All elements with class="intro"
  4. element   - $("p")           -      All p elements
  5. .class.class   - $(".intro.demo")  - All elements with the classes "intro" and "demo"
  6. :first             - $("p:first")           - The first p element
  7. :last              -   $("p:last")           - The last p element
  8.  :even    -  $("tr:even")           -  All even tr elements
  9. :odd            -  $("tr:odd")           -  All odd tr element   
  10. :eq(index)    - $("ul li:eq(3)")   -  The fourth element in a list (index starts at 0)
  11. :gt(no)    -  $("ul li:gt(3)")   -  List elements with an index greater than 3
  12. :lt(no)    - $("ul li:lt(3)")   -  List elements with an index less than 3
  13. :not(selector)  - $("input:not(:empty)")   -   All input elements that are not empty   
  14. :header           - $(":header") -  All header elements h1, h2 ...
  15. :animated        - $(":animated") -  All animated elements   
  16. :contains(text) - $(":contains('Tests')")   -  All elements which contains the text
  17. :empty -  $(":empty")      -   All elements with no child (elements) nodes
  18. :hidden -  $("p:hidden")      -  All hidden p elements
  19. :visible  -  $("table:visible") -  All visible tables  
  20. s1,s2,s3 -  $("th,td,.intro")   - All elements with matching selectors   
  21. [attribute] -  $("[href]")      -  All elements with a href attribute
  22. [attribute=value] -  $("[href='default.htm']")    -  All elements with a href attribute value equal to "default.htm"
  23. [attribute!=value] -  $("[href!='default.htm']")   - All elements with a href attribute value not equal to "default.htm"
  24. [attribute$=value] -  $("[href$='.jpg']")            -   All elements with a href attribute value ending with ".jpg"
  25. [attribute^=value] -  $("[href^='jquery_']")    -  All elements with a href attribute value starting with "jquery_"   
  26. :input         -  $(":input") -  All input elements
  27. :text                 -  $(":text") -  All input elements with type="text"
  28. :password  -  $(":password") -  All input elements with type="password"
  29. :radio         -  $(":radio")         -  All input elements with type="radio"
  30. :checkbox         -  $(":checkbox") -  All input elements with type="checkbox"
  31. :submit -  $(":submit")  - All input elements with type="submit"
  32. :reset -  $(":reset")  - All input elements with type="reset"
  33. :button -  $(":button")  - All input elements with type="button"
  34. :image -  $(":image")  - All input elements with type="image"
  35. :file         -  $(":file")          - All input elements with type="file"   
  36. :enabled -  $(":enabled")  - All enabled input elements
  37. :disabled -  $(":disabled") - All disabled input elements
  38. :selected -  $(":selected") - All selected input elements
  39. :checked -  $(":checked") - All checked input elements
Print Div content with java script

if your div is this,

< d i v id = "mydiv" >
      I want to print this div content
< / d i v >

your onclick function of print button should call to ,

 _print('#mydiv') ;

and the  _print is below.


 var _print = function(elem){
       var data = $(elem).html();
        var mywindow = window.open('', 'my div', 'height=400,width=600');
        mywindow.document.write('');
        mywindow.document.write(data);
        mywindow.document.write('
');
        mywindow.print();
        mywindow.close();

    };




FTL(Fremarker Template Language)

List iteration 

<#list sequence as item>
    ...
</#list>
Where:
sequence: Expressions evaluates to a sequence or collection
item: Name of the loop variable (not an expression)
 list directive process a section of template for each variable existing  in a sequence. The code between the start-tag and end-tag will be processed for the 1st subvariable, then for the 2nd subvariable .. etc until it reach the last one. For each such iteration the loop variable will contain the current subvariable.

There are two special loop variables 
item_index: This is a numerical value that contains the index of the current iterating item
item_has_next: Boolean value that tells if the current item the last in the sequence or not.
Ex:

<#assign seq = ["Banana", "Melon", "Papaya", "Avocado"]>
<#list seq as x>
  ${x_index + 1}. ${x}<#if x_has_next>,</#if>
</#list>  


output:

  1. Banana,
  2. Melon,
  3. Papaya,
  4. Avocado


compress directive is 

Tools that remove white-space from the output (on-the-fly white-space removal):
EX:

<#compress>
<#assign val= holing.val?c!0.00>
</#compress>

Comments