Loading CSS JS Resources in JSF

  <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml” xmlns:h=”http://java.sun.com/jsf/html” xmlns:ui=”http://java.sun.com/jsf/facelets”> <h:head> <h:outputStylesheet name=”basetemplate.css” library=”css”/> <h:outputStylesheet name=”shCore.css” library=”css”/> <h:outputStylesheet name=”shThemeDefault.css” library=”css”/> <h:outputScript name=”shCore.js” library=”js”/> <h:outputScript name=”shBrushXml.js” library=”js”/> <h:outputScript name=”shBrushJScript.js” library=”js”/> </h:head>  

Catching Primefaces form elements in jquery and preventing copy paste and cut operations

xhtml <p:inputText id="firstName" placeholder="#{msg.member_name}" value="#{memberController.order.firstName}" size="30" maxlength="30" widgetVar="firstNameVar" required="true" styleClass="#{not component.valid ? 'ui-input-invalid default-input-text' : 'default-input-text'}" onkeypress="return disallowNonAlphabethCharacters(event);"> <p:ajax delay="1000" event="keyup" oncomplete="rc([{name: 'component', value: ':primeForm:firstName'}, {name: 'widget', value: 'firstNameVar'}]);" /> </p:inputText> javascript <script type="text/javascript"> $( document ).ready(function() { PF('firstNameVar').jq.bind('cut copy paste', function(e) { e.preventDefault(); }); PF('firstNameVar').jq.bind("contextmenu", function(e) { e.preventDefault(); }); }); </script>

Disabling non alphabet characters while entering the input

<p:inputText id="firstName" placeholder="#{msg.member_name}" value="#{memberController.order.firstName}" size="30" maxlength="30" widgetVar="firstNameVar" required="true" styleClass="#{not component.valid ? 'ui-input-invalid default-input-text' : 'default-input-text'}" onkeypress="return disallowNonAlphabethCharacters(event);"> <p:ajax delay="1000" event="keyup" oncomplete="rc([{name: 'component', value: ':primeForm:firstName'}, {name: 'widget', value: 'firstNameVar'}]);" /> </p:inputText>   Javascript <script language="javascript" type="text/javascript"> // <![CDATA[ function disallowNonAlphabethCharacters(e) { var charCode; if (window.event) charCode = window.event.keyCode; //for IE else charCode = e.charCode; //for firefox

Passing the selected maven profile/value to java

in this post we will pass the selected env value to the java file.  when you start the project as follows: -Denv=asseco-test pom.xml <profiles> <profile> <id>asseco-test</id> <activation> <activeByDefault>true</activeByDefault> <property> <name>asseco-env</name> <value>asseco-test</value> </property> </activation> <properties> <profile-id>asseco-test</profile-id> </properties> </profile> <profile> <id>asseco-prod</id> <activation> <activeByDefault>false</activeByDefault> <property> <name>asseco-env</name> <value>asseco-prod</value> </property> </activation> <properties> <profile-id>asseco-prod</profile-id> </properties> </profile> </profiles> java file private Properties

Installation of DCEVM using maven

DCEVM allows you to inject your compiled java code whilst the application is at the running state just like JRebel but freeware. Project site: https://dcevm.github.io/ Download: https://github.com/dcevm/dcevm/releases/ Hotswap download: https://github.com/HotswapProjects/HotswapAgent/releases   for this experiement you’ll need DCEVM and hotswap agent. Download all tools and follow my lead 1. Launch DCEVM jar and patch your corresponding JVM(mind your jvm version is

Hibernate C3P0 pooling integration

hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!– Hibernate Settings –> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://10.10.100.106:3306/nuspa?autoReconnect=true</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">xxxx</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.current_session_context_class">thread</property> <property name="hibernate.hbm2ddl.auto">validate</property> <property name="show_sql">true</property> <!– C3P0 Pooling settings –> <property name="hibernate.c3p0.min_size">7</property> <property name="hibernate.c3p0.max_size">53</property> <property name="hibernate.c3p0.timeout">100</property> <property name="hibernate.c3p0.max_statements">50</property> <property name="hibernate.c3p0.idle_test_period">1000</property> <property name="hibernate.c3p0.validate">true</property> <!– Mapping Entity classes

Life saving commands of SVN

Creating a new repo in remote svn svn mkdir https://svn.XXXX.de/repos/xxx/development/PROJECTNAME/trunk -m “create nuspa directory” Checking out a directory svn co https://svn.xxx.de/repos/xxx/development/PROJECTREMOTENAME/trunk PROJECTNAMETOBECREATEDINLOCAL   Gathering information on the repository svn info or simply get regarding urls svn info | grep url Relocating the location of the project svn relocate  https://scm.adesso.de/scm/svn/adessoturkey/development/xxx/trunk creating a new branch svn cp -m