2014. szeptember 12., péntek

Maven - Webapps, Build Failure

1. mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
2. mvn clean package

BUILD FAILURE

a) error: annotations are not supported in -source 1.3
b) error: package javax.servlet does not exist

SOLUTION

Include to the pom.xml the following:
a)
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
        <source>1.6</source>
        <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

b)
<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.0.1</version>
  <scope>provided</scope>
</dependency>

jQuery - Refresh a div content

If you would like to refresh the content of div_2 when the content of div_1 is changed you can use the following:

jQuery(window).load(function(){
        initialize();
});


rDisplay = function(){
    var lDivId = "div_2";
    jQuery('#' + lDivId).load(location.href+' #' + lDivId);
}


initialize = function(){  
    var div = document.getElementById ("div_1");
    if (div.addEventListener) {
        div.addEventListener ('DOMSubtreeModified', rDisplay, false);
    }
}


You can find more details here.
It's worth to read.