Posts

Showing posts from August, 2015

Set your application context path in Tomcat 7

Set Context path in Tomcat 7 or more using catalina.properties file, Step 1) Add following lines to catalina.properties file under <tomcat-install dir>/conf directory, #myApp war file version myApp .war=myAppLive -1.0.0.1.war myApp .path=/myAppLive #application deployment location appBase=webapps Step 2) Now update context path in <Host> node in server.xml file in same location, <Host name="localhost"  appBase="webapps"             unpackWARs="true" autoDeploy="false"> ... ....     <Context path="${myApp .path}" docBase="${catalina.base}/${appBase}/${myApp .war}"/> ... .... </Host>

Custom directive with dynamic attribute using angular JS

Custom directive with dynamic attribute using angular JS Javascript: var myApp=angular.module('myApp', []); myApp.controller('myCtrl', ['$scope', function($scope) {    $scope.data= [                { name: 'A', size: '12' },                { name: 'C', size: '11' },                { name: 'B', size: '10' }               ]; }]) .directive('myOrderList', function(){   function link(scope, element, attrs) {        var myData=scope.data;            console.log(attrs);            var ulElem=element.html('<ol>');        for(var i=0;i<scope.data.length;i++){                         ulElem.append('<li>'+scope.data[i][attrs.value]+'</li>');         }           }   return {     link: link   }; }); HTML CODE: <div ng-app="myApp"> <div ng-controller="myCtrl">  <div my-order-list value="size"

Maven build is failing to include struts-config.xml or web.xml file to target../../WEB-INF directory

  Maven build is failing to include struts-config.xml or web.xml file to target../../WEB-INF directory due to ‘WebContent ‘ as maven needs ‘ webapps ‘ Add this plugin to pom.xml < plugin > < groupId > org.apache.maven.plugins </ groupId > < artifactId > maven -war- plugin </ artifactId > < version > 2.2 </ version > < configuration > < webResources > < resource > < directory > ${ basedir }/WebContent </ directory > </ resource > </ webResources > < warSourceDirectory > WebContent </ warSourceDirectory > < warSourceExcludes > WebContent/WEB-INF/ lib /*.jar </ warSourceExcludes > < archiveClasses > false </ archiveClasses > </ configuration > </ plugin >

Dynamic response by java and handle using ajax jquery for all content types

Dynamic response by java and handle using ajax jquery for all content types Jquery ajax call              var url= "trackDynamicResponse.do" ;               $.ajax({                                                   url: url,                        type: 'GET' ,                        data :{                              responseType : _responseType                                                       },                        success: function (response, status, xhr){                                                             var ct = xhr.getResponseHeader( "content-type" ) || "" ;                                if (ct.indexOf( 'html' ) > - 1) {                                  console.log( "html ..." );                                                              }                                if (ct.indexOf( 'json' ) > - 1) {                                   console.l

Open popup window with post request data in Javascript

 Open popup window with post request data using javascript:                                  function openWindowWithPostRequest() {            var winName='MyWindow';            var winURL='search.action';            var windowoption='resizable=yes,height=600,width=800,location=0,menubar=0,scrollbars=1';            var params = { 'param1' : '1','param2' :'2'};                       var form = document.createElement("form");            form.setAttribute("method", "post");            form.setAttribute("action", winURL);            form.setAttribute("target",winName);             for (var i in params) {                  if (params.hasOwnProperty(i)) {                      var input = document.createElement('input');                      input.type = 'hidden';                      input.name = i;                      input.value = param