Pages

Thursday, June 15, 2017

Event.stopPropagation() and Event.preventDefault()



1. event.stopPropagation() stops an event from bubbling up the event chain

2. event.preventDefault() will only prevent browser’s default action on that event from occurring, but the event still propogates up the event chain.


Example

$("#myDiv").click(function() {
   alert('click on #myDiv');
});

$("#divButton").click(function(e) {
   alert('button click');
   e.stopPropagation();
});

Friday, December 2, 2011

SSL Certificate err

{http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1649) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1612) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1595) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1172) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149) at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186) at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)


Comments:
  1. Check the truststore path in a .properties file it should be on correct location?
  2. You can try (double escape \) in that path for windows machine.

Thursday, October 20, 2011

Detecting an undefined object in JavaScript


typeof allows the identifier to never been declared before
if (typeof obj == "undefined")
instead of
if(obj == null) // will throw an error due to never declared


Wednesday, August 31, 2011

How to stop caching with jQuery ($.get(), $.ajax() etc) and javascript



To make it unique for each passes, we can place in a random number behind the url as shown below
$.get('remoteUrl.do?'+Math.random()+, function(data){
	$('#msg'+id).html(data);
}, 'html');


Set cache:false 
$.ajax({
	url: 'remoteUrl.do',
	cache: false,
	success: function(data){
		$('#resultDiv').append(data);
	} }); 
$.ajaxSetup({
	cache: false
});
Disable caching using html meta tag:

org.hibernate.PropertyAccessException

nested exception is org.hibernate.PropertyAccessException: Exception occurred inside getter of Hibernate Object

Reason:
  • Nullable database column was mapped to a primitive type property
  • The Hibernate type is not castable to the property type (or vice-versa)

  • Wednesday, July 13, 2011

    Tomcat - JDBC driver unregisted when the web application stops

    SEVERE: A web application registered the JBDC driver [oracle.jdbc.driver.OracleDriver] but failed to unregister it when the web application was stoppe

    Solution:

    Tuesday, June 29, 2010

    Glassfish v2( JDBC Connection Pool, JNDI)

    Step 1:
    Place database driver in glassfish lib dir. (e.g. lib/mysql-jdbc-5.1.11.jar) and restart server.

    Step 2:
    Login to Admin Console: http:\\localhost:4848\
    Goto Resource > JDBC > Connection Pool
    Provide Name, Select Database vendor and Select Resource Type

    Step 3:
    Enter DataSource class name (Database driver)
    Change other settings as you want

    Save and Ping
    :) "Ping Succeed"

    Connection Pool is ready
    Google
     

    Java-Struts