Saturday, July 21, 2012

JQuery

JQuery

 $.ajax() function parameters are as below:-

async A Boolean value indicating whether the request should be handled asynchronous or not. Default is true
beforeSend(xhr) A function to run before the request is sent
cache A Boolean value indicating whether the browser should cache the requested pages. Default is true
complete(xhr,status) A function to run when the request is finished (after success and error functions).
contentType The content type used when sending data to the server. Default is: "application/x-www-form-urlencoded"
context Specifies the "this" value for all AJAX related callback functions
data Specifies data to be sent to the server
dataFilter(data,type) A function used to handle the raw response data of the XMLHttpRequest
dataType The data type expected of the server response.
error(xhr,status,error) A function to run if the request fails.
global A Boolean value specifying whether or not to trigger global AJAX event handles for the request. Default is true
ifModified A Boolean value specifying whether a request is only successful if the response has changed since the last request. Default is: false.
jsonp A string overriding the callback function in a jsonp request
jsonpCallback Specifies a name for the callback function in a jsonp request
password Specifies a password to be used in an HTTP access authentication request.
processData A Boolean value specifying whether or not data sent with the request should be transformed into a query string. Default is true
scriptCharset Specifies the charset for the request
success(result,status,xhr) A function to be run when the request succeeds
timeout The local timeout (in milliseconds) for the request
traditional A Boolean value specifying whether or not to use the traditional style of param serialization
type Specifies the type of request. (GET or POST)
url Specifies the URL to send the request to. Default is the current page
username Specifies a username to be used in an HTTP access authentication request
xhr A function used for creating the XMLHttpRequest object

Difference between Struts 1 and Struts 2

Struts1 extends the abstract base class by its action class. The problem with struts1 is that it uses the abstract classes rather than interfaces. 

While in Struts 2, an Action class implements an Action interface, along with other interfaces use optional and custom services. Struts 2 provides a base ActionSupport class that implements commonly used interfaces. Although an Action interface is not necessary, any POJO object along with an execute signature can be used as an Struts 2 Action object. 
                                                      

Friday, July 20, 2012

Scroller in JQuery

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../scripts/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
var c;
var data=["A","B","C","D","E","F", "G","H","I", "J","K","L", "M","N","O", "P","Q","R", "S","T","U"];
$(document).ready(function(){
      setInterval("asd(c)",1000);
});

function asd(c){
      if(!asd.c)asd.c = 1;
      for (var i = 1; i <= asd.c ; i++){
            for (var j = i ; j > 0 ; j-- ){
                  $("#div"+j).html(data[i-j]);
            }
      }
      asd.c++;
      if (asd.c > data.length){
            asd.c =1;
            $("#div5").html('');
            $("#div4").html('');
            $("#div3").html('');
            $("#div2").html('');
            $("#div1").html('');
      }
}
</script>
</head>
<body>
<input id ="v" value="1" style="display: none;"/>
<table border="1" cellpadding="1" cellspacing="1">
<tr><td height="30px" width="30px"><div id="div5"></div></td></tr>
<tr><td height="30px" width="30px"> <div id="div4"></div></td></tr>
<tr><td height="30px" width="30px"><div id="div3"></div></td></tr>
<tr><td height="30px" width="30px"><div id="div2"></div></td></tr>
<tr><td height="30px" width="30px"><div id="div1"></div></td></tr>
</table>
</body>
</html>

SpringBoot Application Event Listeners

When a spring boot application starts few events occurs in below order ApplicationStartingEvent ApplicationEnvironmentPreparedEvent Applicat...